How will the above code work if

I wanted to ask that as in the video Bhaiyaa has taken the elements as 0,1,2,3,4,5 and therfore in order but let’s say if i take the elements as 1 2 3 4 5 then also the above code will print 0 and many other test cases will be failed

then u are required to start all the loops from 1 and not from 0
or else if u wish to start from 0
then u insert the nodes in a fashion that they start from 0
ie [1-1]-> [2-1]
so this was the nodes start from value 0
and then at the end when u need to print the answer
add 1
so that answer starts from 1

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.