Count Cable Routes Across a Datacenter Floor With Blocked Racks
Last updated: November 29, 2026
Quick Overview
An Azure datacenter floor is a grid where some cells hold racks that cables cannot cross. Count the distinct cable routes from the top-left cell to the bottom-right cell that only move right or down.
Microsoft
November 29, 20260
0
0 solved
An Azure datacenter floor is a grid where some cells hold racks that cables cannot cross. Count the distinct cable routes from the top-left cell to the bottom-right cell that only move right or down.
A grid DP warm-up in the style of Microsoft phone screens for Azure infrastructure teams. The interviewer is checking that the candidate sees the overlapping subproblems, handles blocked start or end cells, and can compress the table to one row.
What the Interviewer Expects
- Define ways[r][c] as routes reaching cell (r, c)
- Set blocked cells to zero ways
- Initialize the first row and column carefully, since one block cuts off everything after it
- Compress to a single row of length cols
- Mention overflow for large grids
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Return the count modulo 1e9+7 on a 1000 by 1000 grid.
- Allow diagonal moves as well. What changes?
- Return the minimum-length route that passes through a required patch panel cell.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
gridis a list of rows, 0 = open, 1 = blocked rack.- Moves: right or down only.
- Output: number of distinct routes; 0 if the start or end is blocked....
High-Level Design
Every route into (r, c) arrives from above or from the left, so ways[r][c] = ways[r-1][c] + ways[r][c-1] for open cells and 0 for blocked ones. A single array works: before updating column c in row ...