Time limit exceeded

i am getting TLE in one of the test cases after submitting this code.can you help me solving this?
here is my code

hello @aditikandhway


after this statement.
check whether rightsuccess is true or not.
if it is true then return true then only no need to check for downsuccess.

make this modification and let me know what verdict u r getting

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.