← Amazon questions

Minimum time to cover all 1s on grid using BFS

Filed under Amazon

Given a 2D matrix containing 0s and 1s and a starting coordinate, find the minimum time required to cover all 1s using BFS, returning -1 if any 1 is unreachable.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.