Obstacle Grid Blocks
Square interview questions · Easy · Coding round · 6 tests
You are given a grid with rows rows and cols columns. Some cells are
blocked by hazards. Starting at the top-left cell (0, 0), count how many distinct
ways there are to reach the bottom-right cell (rows - 1, cols - 1).
Interface
countSafePaths(
rows: number,
cols: number,
hazards: number[][],
): number
Rules
Run your code with Ctrl+Enter to see results.