Tap here to switch tabs
Problem
Submissions

Problem: Minimum Number Game

med
30 min
Try to solve the Minimum Number Game problem.

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

med
30 min
Try to solve the Minimum Number Game problem.

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