Grokking the Coding Interview: Patterns for Coding Questions
Vote

0% completed

​

Solution: Maximum Distinct Elements

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 2 years ago

    auto greaterCountCmp = [](auto lhs, auto rhs){return lhs.second > rhs.second;};     std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, decltype(greaterCountCmp)> minHeap;
A

Anonymous

· 3 years ago

The solution says it can be optimized to run in KLOGK but it doesn't list the optimization. Can someone post it?

Show 1 reply
A

Anonymous

· 4 years ago

There are implied rules that only come up when you explain answers.

Show 2 replies
A

Anonymous

· 5 years ago

Is example 3's explanation correct? Seems like you could remove one instance of 5 and one instance of 4. But removing 4 alone does not jive with K=2

Show 1 reply

Reading Progress

0%


Vote for new content