How do we where is the start of a cycle

i couldnt get why is it that we can reach the start and net is grater than zero we will have a complete cycle…why we are chechking for start ony why not some other pt.

Hello @abhigyanprakash29 try to visualise this we are checking from any node then if it is the valid that we can move and we will not get exhausted in between then we can move but if at any point we will find the we cannot move fiurther then the optimised way is to check whether we can do this from the just next node and if it is possible then we have already traversed the previous we will not be exhausted becase we are keeping the trach how much extra we have with us.
but if we have less then zero at any point then we will check with the node just next to it.
but in the worst case we will not check any node for more then 2n times because if it is being happened then it means that there is no root present.

it is making more sense now…i still am not very clear how we are very sure that we will not run out petrol between them…i ll try with different test cases then contact you…thanks alot

Hey @abhigyanprakash29 yes you can try test cases then also if you are not able to understand anything 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.