Back to course home
0% completed
Vote For New Content
There's an O(N) time & space solution for this question using a slightly modifie...
Will
May 26, 2022
There's an O(N) time & space solution for this question using a slightly modified version of Bucket Sort, specifically useful for this type of question (top K frequent numbers/ letters- see Bucket Sort filtered questions on Leetcode).
Its usage for optimal solutions isn't common, but it still might be useful to link to/ mention this idea.
3
0
Comments
Comments
Design Gurus3 years ago
The first problem of the pattern 'Top K Elements' mentions that.
A detailed discussion on all the possible solutions can be found here: [https://designgurus.org/path-player?courseid=grokking-the-coding-interview&unit=grokking-the-coding-interview_1628744623686_129Unit]...
On this page