⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 47s17 days 22 hours 18 minutes 47 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 47s17 days 22 hours 18 minutes 47 seconds.

Sign in to watch this lesson
Advanced - Geometry · 4:24
Manhattan distance |Δx| + |Δy| is a sum of one term per coordinate, and that makes three tricks possible. Writing each absolute value as a max of signs turns the farthest pair into max - min of x + y and of x - y (2^d sign masks in d dimensions); the integer map (x, y) → (x + y, y - x) turns Manhattan distance into Chebyshev distance and diamonds into axis-aligned squares. A Manhattan minimum spanning tree only needs each point's nearest neighbour in each of 8 octants, found by a sweep over x + y with an ordered map in 4 passes, then Kruskal.