← Back
00:00

Top K Elements

Concentric AI interview questions · Medium · Coding round · 7 tests

You have an integer array nums and an integer k. Find the k values that occur most often in nums; they can be returned in whatever order you like.

This Concentric AI question is the well-known Top K Frequent Elements exercise.

Interface

topKFrequent(nums: number[], k: number): number[]

Examples

Idle