Pacific Atlantic Water Flow
This problem teaches reverse BFS — instead of simulating flow forward, you search backward from each ocean border, which eliminates redundant work and dramatically simplifies the solution.
Enable JavaScript for the full StreamPrep guide.