Gold mine dp problem

code get compilation error and please check code is correct or not.
code – https://ide.codingblocks.com/s/313517

Hey Divesh,
In this statement below you are finding the maximum of three value inside the max function which is not allowed in the default max function provided by c++. you can only find the maximum of 2 elements in the max function .
return dp[i][j]=mat[i][j]+max(a,b,c);
Instead write the below statement
return dp[i][j]=mat[i][j]+max(a,max(b,c));
The above statement will first execute max(b,c) and return the bigger number , the bigger number then will be compared to a and the biggest number of the three will be returned .
I hope this clears your doubt. :slight_smile:
Mark your doubt as resolved if you have no further queries and rate me according to the explanation it will help me boost my rating as well as confidence ;).

thank you so much for clearing the doubt and supporting me.

No Problem @divesh2000 . :blush:
Please mark the Doubt as resolved and rate me if you liked my solution :slight_smile: .