showing MLE on every test case !!
but seems correct…why this on top down code
showing MLE on every test case !!
but seems correct…why this on top down code
now MLE is gone…but not passing last test case
Share your updated code in which you aren’t getting TLE
First mistake, your dp array is of bool type and in line number 36, you are initialising all it’s index to -1, it can be either 0 or 1 I.e., true or false
This is your debugged code, it might give you right output
Also I would suggest you to see this approach also