This question evaluates understanding of grid-based graph traversal, shortest-path reasoning, and obstacle handling, testing competence in algorithmic problem-solving and complexity analysis within the Coding & Algorithms domain.
You are given an m x n grid of integers where cells with value -1 represent obstacles and all other cells are traversable. Starting at (0, 0) and targeting (m-1, n- 1), compute the length of the shortest path using only four-directional moves (up, down, left, right). Return -1 if the target is unreachable. Describe your algorithm, prove its correctness at a high level, analyze time and space complexities, cover edge cases (e.g., blocked start/goal, single-cell grid), and provide pseudocode.