Tap here to switch tabs
Problem
Submissions

Problem: Sort Array by Increasing Frequency

Sort Array by Increasing Frequency asks you to reorder an integer array by each value’s occurrence count, placing less frequent values first and breaking ties by putting larger values first.

Statement

Given an array of integers nums, sort the array in increasing order based on the frequency of each value. If multiple values share the same frequency, sort those values in decreasing order.

Return the sorted array.

Constraints:

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

  • −100≤-100 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Array by Increasing Frequency

Sort Array by Increasing Frequency asks you to reorder an integer array by each value’s occurrence count, placing less frequent values first and breaking ties by putting larger values first.

Statement

Given an array of integers nums, sort the array in increasing order based on the frequency of each value. If multiple values share the same frequency, sort those values in decreasing order.

Return the sorted array.

Constraints:

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

  • −100≤-100 \leq nums[i] ≤100\leq 100