Search⌘ K
AI Features

Sort Array by Increasing Frequency

Sort Array by Increasing Frequency asks you to return an integer array ordered by each value's occurrence count, with less frequent values first and larger values breaking ties.

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 ...