← All problemsSign in

3 Paths

CodeChefRating 1527Open on judge ↗

For a given binary grid $A$ of size $N \times N$, we define $f(A)$ as the number of distinct right-down paths that can be taken from $(1, 1)$ to $(N, N)$ such that all the cells $(i, j)$ you visit have $A[i][j] = 1$. A right-down path means that from the cell $(X, Y)$ you can go to either $(X + 1, Y)$ or $(X, Y + 1)$. Construct a grid $A$ with exactly $3$ paths, or claim there does not exist any

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start