Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
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
Design Gurus
Design Gurus4 years ago