Simple Enough : Divide and Conquer

I am getting run- error for my code.
Can you pls help me out with this one ?
IDE : https://ide.codingblocks.com/s/196155

@aman_ishan I cannot see any runtime error operation in your code bit since I am not a Java coder I would recommend you to check your syntax and compile time errors.

Is there a possibility that it may give TLE ? If yes, how to optimize it ?

@aman_ishan You can use DP and store the states so that you don’t have to precompute again and again

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.