Search
⌘K

Leetcode 1636. Sort Array by Increasing Frequency

Reorder the array so integers with lower occurrence come first, and when frequencies tie place larger numbers before smaller ones. This is solved by counting frequencies (hash map or counting array) and sorting the elements with a custom comparator that uses (frequency ascending, value descending).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.