DSA Trainer
← All problems
PremiumHeap / Priority QueueMedium

K Closest Points to Origin

Asked at:AmazonGoogleMeta

Given an array of points on a 2D plane, return the k points closest to the origin (0, 0). Distance is Euclidean. The answer can be in any order.

Teaches the Heap / Priority Queue pattern.

Already doing the free problems? This picks up right where they leave off. Same format, harder patterns, the ones that show up in every FAANG-style screen.

What you get

  • Stop going blank on algorithm problems. The hint ladder walks you to the answer without spoiling it.
  • Actually internalize the trace: dry runs walk state row by row so it clicks before you write a line
  • Know when to reach for each pattern. Every problem names the trigger so you spot it next time.
  • Write and run JS or Python in the browser with real test cases on every problem
  • Access every new problem and pattern guide as they ship weekly
  • Vote on what gets built next with the founding member feature request form
B
Big_Wolverine_7575Founding Member· unprompted on Reddit

“This app finally made it click. I tried NeetCode, CTCI, and YouTube for years and still couldn't solve Two Sum. The beginner mental models for the patterns are genuinely so helpful. THANK YOU.

Price locks in for life · First 100 only

Founding Member Deal

$29 / year

or $6 / month

LeetCode Premium is $159/year and doesn't teach you anything.

Less than one Udemy course, with guided problems instead of passive lectures.

Your price is locked in for life.

When the 100th founding spot closes, the price goes up for everyone who joins after. Your rate never changes, no matter how much the curriculum grows.

  • All problems + every new one
  • New problems and patterns weekly
  • Feature request form
  • Cancel anytime

Cancel anytime. Not useful within 7 days? Email for a full refund. Secured by Stripe.