Python data engineering interview problem. Difficulty: beginner. Pattern: Searching. About 10 minutes. Part of the Pro drill bank.
A warehouse stores pickup coordinates. Dispatch wants the stored point closest to a reference location. Coordinates should be treated as immutable records, not loose tuples you accidentally mutate.
Given stored points and a reference point, return the closest coordinate record.
Input: closest_coordinate([(0, 0), (2, 2)], (1, 1)) Output: (0, 0) This input follows the stated rules and produces this output.
Topics: lakebench, python, tuples.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given a list of (lat, lon) tuples, return the pair closest to a reference point.
Given stored points and a reference point, return the closest coordinate record.