AceStack AI

Coding (Algo)

Dynamic programming 2D: count paths while respecting blocked cells

Dynamic programming 2D: Count paths from the top-left to bottom-right of a rectangular 0/1 grid, moving only right or down and never entering a blocked cell marked 1.

Input: A JSON object { "grid": number[][] } containing only 0 and 1.

Output: A JSON integer path count.

Constraints:

  • 0 <= rows, columns <= 500
  • The grid is rectangular
  • A blocked start or destination produces 0 paths

Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.

Difficulty: EASY. Variant: 4. Balance correctness, maintainability, and clear review-ready code.

Practice context

This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked easy difficulty.

The signed-in workspace provides the tools required by the round, such as recording, code execution,

What this task practices

This coding (algo) exercise trains the same sequence expected in an interview: understand the prompt, make assumptions explicit, produce a concrete answer, and explain the decisions behind it. The task is marked easy difficulty. The private workspace adds the tools required by this round, such as recording, code execution, diagrams, evidence panels, or structured notes. It also preserves the attempt so later feedback can be compared with previous work. Evaluation is based on task-specific criteria and the candidate seniority selected in the preparation path. Public pages never expose the reference solution, hidden tests, evaluator instructions, or another candidate’s work.

Sign in to startThe workspace and evaluation open after sign in.
Sign in to continuethis interview task

Continue to AceStack.

Continue securely with an available identity provider. If you are new, we will create your account automatically.

Continue with Google

By continuing, you agree to the Terms and acknowledge the Privacy Policy.

Your destination is saved. After access, you will continue exactly where you intended to go.