Top K frequent Elements

Balaji MJ
Oct 12, 2021

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

This problem can be solved using Heap(Priority Queue), Hashtable, Hashmap.

As we see here, there are two methods.

--

--

Balaji MJ

I write about Software Engineering, Backend Development, Algorithmic Trading, Quantitative Finance, and our Mind and Universe.