Question bank › Dynamic Programming
Dsa Dynamic Programming Easy

Min Cost Path

You are given a 2D grid where each cell contains a non-negative integer representing the cost of traversing that cell. Your goal is to find the minimum cost to go from the top-left corner to the bottom-right corner of the grid, moving only down or right. Write a program to compute the minimum cost path. Input format: - The first line contains the integers `m` and `n` (1 ≤ m, n ≤ 100). - The next `m` lines each contain `n` integers representing the cost grid. Output format: - A single integer representing the minimum cost to reach the bottom-right corner. Example: Input: 3 3 1 3 1 1 5 1 4 2 1 Output: 7

Key concepts

dynamic_programminggridmatrix

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.