Dsa
Matrix
Medium
Matrix Maximum Path
You are given an m x n matrix filled with positive integers. You can only move down or right from a cell. Write a program to find the maximum sum path from the top-left cell to the bottom-right cell.
Input format:
The first line contains two integers m and n (1 <= m, n <= 100), the dimensions of the matrix. The next m lines each contain n integers, the matrix values.
Output format:
Print a single integer, the maximum path sum.
Example:
Input:
3 3
5 3 2
1 2 10
4 1 1
Output:
22
Key concepts
matrixpathdynamic programming
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now