0

For the question https://leetcode.com/problems/top-k-frequent-elements to find top k frequent elements I understand we can use heapq.nlargest() method but for that the key used is just dict.get without braces - heapq.nlargest(k,count.keys(),key=count.get)

If we try to print dict.get it returns object and if we try to use dict.get() without key it throws error.

So can someone explain me what does it mean to use dict.get without braces as key?

0 Answers0