Last Day Where You Can Still Cross
A hard-tier problem at 62% community acceptance, tagged with Array, Binary Search, Depth-First Search. Reported in interviews at Atlassian and 0 others.
Last Day Where You Can Still Cross is a hard grid problem that looks deceptively simple at first. You're given a 2D grid where water blocks are added day by day, and you need to find the last day you can cross from left to right before water floods your path. With a 62% acceptance rate, it's not a massacre, but the trap is obvious: simulate day-by-day and run BFS or DFS each time. That works, but it's slow. The real move is binary search on the answer combined with a connectivity check, or Union Find to avoid redundant path searches. If this hits your live assessment and the brute force feels wrong, StealthCoder surfaces the optimized approach in seconds.
Companies that ask "Last Day Where You Can Still Cross"
Last Day Where You Can Still Cross is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe trick here is recognizing that day-by-day simulation is wasteful. Once water blocks you on day X, you're blocked on day X+1 too. So you can binary search on days: find the earliest day where no left-to-right path exists. Within each binary search iteration, you run a single graph traversal to check if a path remains. The alternative is Union Find in reverse, starting from the final state and removing water blocks backward, merging land cells until left and right banks connect. Both approaches drop the complexity dramatically compared to checking every single day. The hard part isn't the algorithm, it's recognizing that binary search or reverse Union Find is faster than the simulation trap. Matrix problems with connectivity checks often hide this pattern.
Pattern tags
You know the problem.
Make sure you actually pass it.
Last Day Where You Can Still Cross recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Last Day Where You Can Still Cross interview FAQ
Is this really asked at FAANG-level companies?+
Atlassian has reported it. It's a hard-tier grid and graph hybrid, so yes, strong signal for senior/L4+ roles. The 62% acceptance suggests many candidates are either grinding the right pattern or brute-forcing and getting lucky with weak test cases.
What's the most common mistake?+
Simulating day-by-day and running BFS/DFS each time. Works on small inputs, times out on large grids. The 'aha' is binary search or reverse Union Find. Miss that and you'll be optimizing the wrong solution during the OA.
Does Union Find actually perform better than binary search plus BFS?+
Both are optimal. Union Find reverse is cleaner if you're comfortable with the data structure. Binary search plus BFS is more intuitive. Pick the one you can code cleanly in 15 minutes without bugs.
How does this relate to typical matrix problems?+
It combines Array, Matrix, and Graph concepts. Standard flood-fill or connectivity check from left to right. The timing trick, binary search on answer, is less common and separates strong candidates from those who memorize individual problems.
Will brute force pass the test cases?+
Maybe on smaller inputs, maybe not. With a 62% pass rate, some brute force solutions likely got through. But you can't rely on weak test cases in a real OA. The safe move is binary search or Union Find from the start.
Want the actual problem statement? View "Last Day Where You Can Still Cross" on LeetCode →