Trains the technique from
LeetCode 63Unique Paths IIThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A rigging crew works on a scaffold deck laid out as a rectangle of square panels. You are given deck, where deck[r][c] is 1 when that panel is stacked with material and cannot be stepped on, and 0 when the panel is clear.
A crew member stands on the north-west panel deck[0][0] and has to end up on the south-east panel. Each step moves onto the panel immediately east or the panel immediately south of the one being stood on, and every panel stepped on has to be clear.
Return how many different step sequences take the crew member from the north-west panel to the south-east panel. If either of those two corner panels is stacked, no sequence exists and the count is 0.
Example 1
The stacked panels are `deck[1][1]` and `deck[2][3]`. Four step sequences stay on clear panels, one of them being east, east, south, south, south, east.
Example 2
Only south, east, east keeps to clear panels: any sequence that opens with a step east lands on the stacked panel `deck[0][1]`.
Example 3
The north-west panel is itself stacked, so the crew member has nowhere to stand at the start and no sequence can be counted.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def count_deck_routes(deck: list[list[int]]) -> int:public int countDeckRoutes(int[][] deck)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.