from queue import Queue class Solution: def deckRevealedIncreasing(self, deck): n = len(deck) que = Queue(maxsize=n) deck.sort() res = [0]*n for i in range(n): que.put(i) for i in range(n): index = que.get() val = deck[i] res[index]=val if not que.empty(): que.put(que.get()) return res