Build the PrimitiveMedium
Pacific Atlantic Water Flow
Write `pacific_atlantic(heights)` returning every cell from which water can reach both oceans. Water flows to a neighbour of equal or lower height. The Pacific touches the top and left edges, the Atlantic the bottom and right.
Searching downhill from every cell is O(cells^2). Instead run two searches *uphill* from the edges — from the ocean, climbing to cells of equal or greater height — and intersect the two reachable sets. Flipping the comparison is the entire trick.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.