← Questions

Top K frequent elements and K closest points

0
GoogleCodingLast asked Feb 2026

Two warm-up style problems that the interviewer combined into one round:

  1. Return the k points closest to the origin.
  2. Return the k most frequent values in a list.

Then combine them: rank items by frequency and break ties (or filter) by distance. Discuss heap versus quickselect and their complexity.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding