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.