Sir please check my code its not working


the logic is fine. i checked it manually it working. but when i input in loop its not. please check

@Shivanchal-Agarwal-2530139037020445 hey your logic seems correct to me shayad ap input galat lerhe ho ,take input correctly.

sir nahi samajh aa raha galti kaha ho rahi hai ek baar please check karlo input

sir what i figured out was that last input lete time addedge is not working. please check why


sir ye check karna please

@Shivanchal-Agarwal-2530139037020445 hey let me check your code.

@Shivanchal-Agarwal-2530139037020445 If it is not taking last node then change loop from 1 to equal to n.

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.