Tap here to switch tabs
Problem
Submissions

Problem: Rearrange Array by Removing Distinct Values

Try to solve the Rearrange Array by Removing Distinct Values problem.

Statement

You are given an integer array nums.

You repeatedly perform the following operation until nums becomes empty:

  1. Identify all distinct elements present in nums.

  2. Append these distinct elements in ascending order to an array ans.

  3. Remove one occurrence of each of these identified elements from nums.

Return the resulting array ans.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Rearrange Array by Removing Distinct Values

Try to solve the Rearrange Array by Removing Distinct Values problem.

Statement

You are given an integer array nums.

You repeatedly perform the following operation until nums becomes empty:

  1. Identify all distinct elements present in nums.

  2. Append these distinct elements in ascending order to an array ans.

  3. Remove one occurrence of each of these identified elements from nums.

Return the resulting array ans.

Constraints:

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

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