Sir, please have a look on my code. I failed in some test cases

hello @chandreshmaurya

the loop is incorrect.

in top down u need to solve all 1 length then all 2 lenght then all 3 length so on.
becuase answer of higher lenght subarray is dependent on lower length so answer for lower lenght must computed first,same is not ensured in ur code