saumilsjsu / Heaps-2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heaps-2

Problem1: Top K Frequently Repeating Elements(https://leetcode.com/problems/top-k-frequent-elements/)

from a array of integers, find the k most frequent elements.

Example 1:

Input: nums = [1,1,1,2,3,3], k = 2

Output: [1,3]

Example 2:

Input: nums = [1], k = 1

Output: [1]

Your algorithm's time complexity must be better than O(n log n), where n is the array's size.

About