Compute minimum escape time in a grid
Company: Snapchat
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates a candidate's competence in graph traversal, shortest-path computation, and reachability analysis on grid-based representations.
Read the full Snapchat Software Engineer interview experience this question came from
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: (['P.E','...'],)
Expected Output: 2
Explanation: One person reaches the nearest exit in two steps.
Input: (['P#E'],)
Expected Output: -1
Explanation: A wall can make escape impossible.
Hints
- Run multi-source BFS from all exits.
- Then read each person distance.