Reveal Cards In Increasing Order

You are given an integer array deck where every card has a unique integer. You can order the deck in any way you want. Initially, all the cards start face down in one deck. Repeatedly take the top card, reveal it, take it out, and then if there are still cards, put the next top card at the bottom of the deck. Return an ordering of the deck that would reveal the cards in increasing order. The first entry in the answer is considered to be the top of the deck.

Constraints

  • 1 <= deck.length <= 1000
  • 1 <= deck[i] <= 10^6
  • All the values of deck are unique.
Saving… · 3 lines
class Solution:
def revealCardsInIncreasingOrder(self, deck: List[int]) -> List[int]:

Console

Click Run to execute sample tests.