Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number Game

Minimum Number Game gives an even-length integer array. Simulate each round: Alice removes the smallest value, Bob removes the next smallest, then return an array with Bob's value before Alice's.

Statement

You are given an integer array nums of even length.

Alice and Bob play a game with nums and an initially empty array arr. The game continues until nums is empty, where in each round:

  • Alice removes the smallest element currently in nums.

  • Bob then removes the smallest element from the remaining elements in nums.

  • Bob appends his removed element to arr.

  • Alice appends her removed element to arr.

Return the resulting array arr.

Constraints:

  • 2≤2 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

  • nums.length \\% 2 = 0

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number Game

Minimum Number Game gives an even-length integer array. Simulate each round: Alice removes the smallest value, Bob removes the next smallest, then return an array with Bob's value before Alice's.

Statement

You are given an integer array nums of even length.

Alice and Bob play a game with nums and an initially empty array arr. The game continues until nums is empty, where in each round:

  • Alice removes the smallest element currently in nums.

  • Bob then removes the smallest element from the remaining elements in nums.

  • Bob appends his removed element to arr.

  • Alice appends her removed element to arr.

Return the resulting array arr.

Constraints:

  • 2≤2 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

  • nums.length \\% 2 = 0