Dsa
Dynamic Programming
Easy
Traveling Minimum Cost
You are given a grid of size m x n representing the cost of traveling from the top-left corner to the bottom-right corner. Each cell contains a cost value. You can only move right or down. Calculate the minimum cost to reach the bottom-right corner from the top-left corner.
Input:
- The first line contains two integers, m and n (1 <= m, n <= 100).
- The next m lines contain n integers representing the grid, where each integer is the cost (1 <= cost <= 100).
Output:
- A single integer representing the minimum travel cost.
Example:
Input:
3 3
1 3 1
1 5 1
4 2 1
Output:
7
Key concepts
dynamic_programminggridpath
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