Dsa
Matrix
Hard
Matrix Path with Maximum Sum
Given a 2D grid of integers, you want to find the maximum path sum from the top-left corner to the bottom-right corner, where you can only move down or to the right at any point in time. Return the maximum sum of the path taken.
Input:
- The first line contains two integers m (number of rows) and n (number of columns),
- The next m lines each contain n integers representing the grid.
Output:
- A single integer representing the maximum path sum.
Example:
Input:
3 3
5 3 2
1 4 7
2 1 6
Output:
18
Key concepts
matrixpathmax sum
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