You have a deck of cards with different numbers. You may order the deck any way you like, then repeat these steps until all cards are revealed: take the top card, reveal it and remove it; then, if cards remain, move the next top card to the bottom of the deck.
Return the order of the deck (top first) for which the revealed cards come out in increasing order.
For [17, 13, 11, 2, 3, 5, 7] the answer is [2, 13, 3, 11, 5, 17, 7].
Example 1
Input:
reveal_cards([17, 13, 11, 2, 3, 5, 7])
Output:
[2, 13, 3, 11, 5, 17, 7]
Example 2
Input:
reveal_cards([1, 1000])
Output:
[1, 1000]
0 <= len(deck) <= 1000001 <= deck[i] <= 10**9.No results yet
Run your code to check it against the examples, or submit to run every test.