RUN ERROR,PLEASE CHECK
@gaganpreetsachdev1 hey your logic is correct but since the constraints are large so try to solve using dp .
Hey I want to stick to this logic. Can you make my code more memory efficient??
@gaganpreetsachdev1 hey your code is gining tle . so you have to optimised your code in terms of time complexity not space complexity. your code will work fine in case of small inputs but for large inputs you have to change your code.
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.