Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

K Closest Points to Origin

MediumLeetCode 973 ↗

The problem, in one line. Given points on a plane and a number k, return the k points nearest the origin, in any order. LeetCode 973.

The tell. “The k best by some score”. The score here is distance, which you compute, rather than a value you are handed. The shape is the same as the kth largest: keep a small pile and evict the loser.

Included with a plan

This solution is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.