i don’t know whats going wrong please help
Https://ide.codingblocks.com/s/170875
Hey Sathak! I ran your code and there are a number of mistakes at the link you provided:
- You have commented out the memo due to which it’s running indefinitely
- Your last index in your array is supposed to be n and not n-1 because you have chosen 1 indexing and not 0 indexing in your array
- An important base case is missing, when the index becomes greater than the last index, think about it?
- And most importantly,your final ans is the minimum of all recursion calls and not the sum of them.
Check out all of these yourself and if still problem assists, I will be more than happy to make changes in your code! Thanks!