Plz correct this code

Hey @devwrath1999 greedy approach won’t work in this problem. Think this problem recursively, and then apply dp in it. If you are unable to solve it. Let me know, i will help.

Do you need any more help in this question? Cause i have to mark this doubt as resolve to.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.