Please check and tell whether the code is incorrect or am I getting TLE because I’m using recursion instead of DP.
I don't know DP yet and this is my recursion solution but i get TLE
@amanb25
The constraints are big. You thus need DP approach to solve the question. Please try the question after getting to know of the DP approach. You will be able to solve it easily then.
If my answer is able to solve the doubt, please mark the doubt as resolved.