• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
December 13, 2023 |1.0K Views
PROBLEM OF THE DAY : 12/12/2023 | Gold Mine Problem
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Jay Dalsaniya. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Array but also build up problem-solving skills.

In this problem, we are given, a gold mine called M of (n x m) dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner can start from any row in the first column. From a given cell, the miner can move

to the cell diagonally up towards the right 
to the right
to the cell diagonally down towards the right

Find out maximum amount of gold which he can collect until he can no longer move.

Example :

Input: n = 3, m = 3
M = {{1, 3, 3},
    {2, 1, 4},
    {0, 6, 4}};
Output: 12

Explanation: 
The path is {(1,0) -> (2,1) -> (2,2)}.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/gold-mine-problem2608/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/1d2a9c84-f24f-4e3e-9e56-ecaef446e164