# Top k frequent elements — Aced

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/2080/top-k-frequent-elements
Source observed: 2026-11-05T00:26:48.528Z
Last checked: 2026-11-05T00:26:48.528+00:00
Indexed: 2026-11-07T01:00:18.089+00:00

---

# Top k frequent elements

We provide interview-preparation questions, interview experiences, community answers, and related courses through Aced (formerly Exponent).

## Question

Given an array of **n numbers** and a positive integer **K**, find the **K numbers that appear most frequently** in the array. If there is a tie, any set of K numbers can be returned.

- Category: [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms)
- Additional category: [Coding](https://www.aced.io/questions?type=coding)
- Roles associated with this question: [Software Engineer](https://www.aced.io/questions?role=swe), [Data Engineer](https://www.aced.io/questions?role=data-engineer), and [Data Scientist](https://www.aced.io/questions?role=data-science)
- Companies associated with this question: [Amazon](https://www.aced.io/questions?company=amazon), [Verily](https://www.aced.io/questions?company=verily), [Apple](https://www.aced.io/questions?company=apple), [Adobe](https://www.aced.io/questions?company=adobe), and [Microsoft](https://www.aced.io/questions?company=microsoft)
- The question is associated with **+26 interviews**.
- Reported last asked: **5 days ago**.

Detailed company statistics require an upgrade: [Upgrade](https://www.aced.io/upgrade?src=questions).

## Interview experiences

We have **3 shared interview experiences** for this question:

1. [Verily · 5 days ago](https://www.aced.io/experiences/verily-software-engineer-interview-94d7fd) — Software Engineer, Mid Level / L4
   > “Overall smooth process, I was surprised by how technical the interviews were, there was very little behavioral questioning.”

2. [Amazon · 4 months ago](https://www.aced.io/experiences/amazon-software-engineer-interview-154103) — Software Engineer, Mid Level / L4
   > “Overall experience was average, for last round interviewer was not friendly and he was not helping instead of I ask something they go deep into it”

3. [Amazon · 3 years ago](https://www.aced.io/experiences/amazon-senior-software-engineer-interview-5f3e3b) — Software Engineer, Senior / L5
   > “The interview was quite smooth. All of the interviewers asked their direct questions with no further small talk.”

## Community answers

No answers have been contributed by the community yet. You can log in or sign up to submit an answer and mark the question complete.

## Related courses

### [Data Science Interview Prep](https://www.aced.io/courses/data-science)

![Data Science Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/3U4C5C0OkDR0UeGch4AmlE/7ad489430b676a088cb973307fe77884/Data_Science_Interview_Prep_Course.jpeg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for data science roles at Google, Amazon, Microsoft, Meta, Apple, and other top companies. The course includes mock interviews, frameworks, and advice from senior candidates, with practice in statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.

### [Data Engineering Interview Prep](https://www.aced.io/courses/data-engineering)

![Data Engineering Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/5XoOCgXlGqN2fa1zaroNWd/9a2e23df48a212bc00d352873feb2d6a/Data_Engineer_Interview_Prep_Hero_Image.jpg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for data engineering roles at Meta, Google, Amazon, Microsoft, Walmart, DoorDash, and other top companies. The course includes mock interviews, frameworks, and advice from senior candidates, with practice in data modeling, pipeline design, SQL, coding, behavioral interviews, and more.

## Aced resources

We offer interview courses and practice resources across Product Management, Forward Deployed Engineering, Engineering Management, Software Engineering, System Design, Data Science, Machine Learning, Data Engineering, AI Engineering, Investment Banking, Generative AI, Security Engineering, TPM, Solutions Architecture, UX / Product Design, and BizOps & Strategy. We also offer interview loops, interview experiences, practice, coaching, resume review, salary negotiation, job referrals, resources, and related services.

- [All Questions](https://www.aced.io/questions)
- [Courses](https://www.aced.io/courses?src=nav)
- [Experiences](https://www.aced.io/experiences?src=nav)
- [Practice](https://www.aced.io/practice?src=nav)
- [Coaching](https://www.aced.io/coaching?src=nav)
- [Pricing](https://www.aced.io/upgrade?src=nav)
- [Log in](https://www.aced.io/login?src=nav)
- [Sign up](https://www.aced.io/signup?src=nav)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F2080%2Ftop-k-frequent-elements&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F2080%2Ftop-k-frequent-elements). Opening a form does not execute a tool.