Reveal Cards In Increasing Order

Given a deck of unique integers, return the deck order that reveals cards in increasing order. Pattern focus: Queue for Task Simulation. Simulate the reveal process with queue order to reconstruct the hidden deck arrangement.

Input Format

deck = array of unique card values

Output Format

initial deck order that reveals cards in increasing order

Constraints

  • 1 <= input size <= 10^5
  • -10^9 <= numeric values <= 10^9
  • deck must satisfy the format described in inputFormat.

Examples

Example 1:

Input:

deck = [17,13,11,2,3,5,7]

Output:

[2,13,3,11,5,17,7]

Explanation:

This arrangement reveals cards in sorted order.

Example 2:

Input:

deck = [1,1000]

Output:

[1,1000]

Explanation:

The two cards already satisfy the reveal order.

Loading...
Reveal Cards In Increasing Order - Queue Deque