17- Minimum cost path in matrix

Minimum cost path in matrix

Description

Given a matrix of integers matrix of size n*m, where each element matrix[i][j] represents the cost of passing from that cell, create a function that returns the cost of the minimum cost path to go from the top left cell to the right bottom cell, knowing that you can only move to the right or to the bottom.

Example 1:

  • Input: matrix = [[3, 12, 4, 7, 10], [6, 8, 15, 11, 4], [19, 5, 14, 32, 21], [1, 20, 2, 9, 7]]
  • Output: 54
  • Explanation:

Try some input:

matrix =

Expected output:

Try to solve:

Select a language:






Solution:

Code:

Select a language:





Frequently asked questions:

No questions yet.
You can ask a question in comment section below.

Complete and Continue  
Discussion

0 comments