Reveal Cards In Increasing Order
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You hold a deck of cards with **distinct** integers deck, and you may arrange the deck in any order before starting. Then this process repeats until the deck is empty:
1. Take the top card off the deck and reveal it.
2. If cards remain, move the new top card to the bottom of the deck.
Return an ordering of the deck (index 0 is the top) such that the cards are revealed in **strictly increasing** order. Because the values are distinct, exactly one such ordering exists.
Examples
Constraints
- 1 <= deck.length <= 1000
- 1 <= deck[i] <= 10^6
- All values in deck are distinct
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.