AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
You are given an `m × n` integer array `obstacleGrid`. There is a robot initially located at the top-left corner (`obstacleGrid[0][0]`). The robot tries to move to the bottom-right corner (`obstacleGrid[m-1][n-1]`). The robot can only move either down or right at any point in time. An obstacle and space are marked as `1` or `0` respectively in `obstacleGrid`. A path that the robot takes cannot include any square that is an obstacle. Return the number of possible unique paths that the robot can take to reach the bottom-right corner. The testcases are generated so that the answer will be ≤ 2 · 10⁹.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.