Vivek and Array Game giving TLE

Sir Getting TLE inspite of using DP table.

Hello @pangatt4 this is not about dp.
your approach should be optimise as well.
you can solve this question without dp as well.
try to think in the more optimised way.
check for the cases for whic you are inlcuding or not if they are not included then only they will give TLE.
if you have any doubt you can ask here:
Happy Learning!!

Hello @pangatt4 you can check this code:


if you have any doubt you can ask here:
Happy Learning!!

In the above mentioned code, we are considering only first occurrence where leftsum==rightsum and discarding the rest by breaking the loop, why is it such?

Hello @pangatt4 it is given in the question that vivek can score points only if he is able to divide the array in two parts of equal sum only then he will be able to score the points.
if you have any doubt you can ask here:
Happy Learning!!

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.