Problem Challenge: Frequent Integers

Solve a problem to test and practice your knowledge and understanding of tries.

Problem statement

Given an array of integers and an integer KK, return the KK least frequent integers present in the array sorted by their frequency. In case there is a tie in frequency, sort the integers lexicographically.

Example

Sample input

Get hands-on with 1400+ tech skills courses.