Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

m =
n =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Grid DP: ways to reach cell = from top + from left.

Approach

Use 1D DP per row: dp[c] stores ways to reach current row, column c. Update: dp[c] += dp[c-1].

Code
Loading...
Complexity
Time: O(mn)
Space: O(n)
Solution
Updated: 2026-02-23

Idea

Grid DP: ways to reach cell = from top + from left.

Approach

Use 1D DP per row: dp[c] stores ways to reach current row, column c. Update: dp[c] += dp[c-1].

Code
Loading...
Complexity
Time: O(mn)
Space: O(n)