Solve Rotting Oranges and Bus Walk Reachability
AmazonSoftware Engineer · OnsiteLast updated
This question evaluates graph and grid traversal skills, state modeling over time, and constrained reachability combining free transit edges with Manhattan-distance walking.
Question
LeetCode 994. Rotting Oranges. 2) Given start and end grid coordinates, an integer k (maximum walking distance), and a bidirectional graph of bus stations represented by coordinate pairs where bus travel is free and walking between any two points costs Manhattan distance, determine whether you can reach the end from the start using any sequence of bus rides plus walking with total walking distance ≤ k.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.