head === null || halfReversed === null
The above conditions has comment if both halves match
But the code says otherwise.
I think it’s a typo and should be corrected to head === null && halfReversed === null
Any thoughts?
Thanks
head === null || halfReversed === null
The above conditions has comment if both halves match
But the code says otherwise.
I think it’s a typo and should be corrected to head === null && halfReversed === null
Any thoughts?
Thanks
hi Gaurav
I don’t think its a typo
consider this example:
1->2->2->1
after comparing head with head_second_half, head will move to 2nd 2 whereas head_second_half will move to null