Question bank › Dynamic Programming
Dsa Dynamic Programming Hard

Min Cost Path in Grid

You are given a grid of size m x n filled with non-negative integers, where each cell represents the cost to enter that cell. The goal is to reach the bottom-right corner starting from the top-left corner, minimizing the total cost. You can only move either down or right at any point in time. Input format: - The first line contains integers m and n (1 <= m, n <= 100). - Each of the next m lines contains n space-separated integers representing the cost matrix (0 <= cost <= 100). Output format: - Print a single integer representing the minimal 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_programminggrid

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