← Questions

Top K frequent elements

0
AmazonAppleGoogle+3CodingLast asked Nov 2026

A coding interview question asked in Amazon's technical phone screen and at Google, Meta and 3 more companies, last asked Nov 2026. It tests hash maps, heaps and bucket sort.

Given an integer array and k, return the k values that occur most often. Order them by count, highest first; break ties by the smaller value.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Amazon · Technical phone screen · Last asked Nov 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
  • Google · Onsite coding · Last asked Apr 202645 min · Usually two rounds, mostly in person: whiteboard plus a Chromebook with Google Docs · No AI (a pilot code-comprehension round lets candidates use Gemini)
  • Meta · AI-enabled coding · Last asked Feb 202660 min · Several progressive tasks on a starter codebase in CoderPad with an AI assistant panel; usually two rounds · The first task usually without AI, later tasks with it
  • Microsoft · Technical phone screen · Last asked Feb 202660 min · One technical round
  • Nvidia · Technical phone screen · Last asked Jan 2026Live technical interview, 45 to 90 minutes; a project discussion, then a small task
  • Apple · Technical phone screen · Last asked Sep 2025

What it tests

hash maps · heaps · bucket sort

Your code and the AI tutor open when you unlock this question.