Home
Hyeseon Ko
Cancel

Top K Frequent Elements: Why Eviction Is Safe

LC347 Top K Frequent Elements asks for the k most frequent values in an array. The real question The problem splits into two steps, and only one of them is interesting: Count how often each n...

Group Anagrams: Choosing a Canonical Key

LC49 Group Anagrams asks you to group words that are permutations of each other. The real question Grouping is trivial once you have the right key: build a dict from key to list, append, done. Th...