(OP was solving in JavaScript)
your implementation of count() has a bug, it skips the last element of the list because your while(head.next) is not entered for the penultimate element. not a kata issue.
count()
while(head.next)
Happened to me as well. I got around it by pushing a 3 to the LL in my solution
Same issue here
Wrong test case for count. Can't submit. LL generated by running buildOneTwoThree() is 1->2->null but have a positive test for 3
Thanks for the feedback, the kata description has been updated.
Description doesn't makes its clear for getting NaN in case of '1 2 3'
Loading collection data...
(OP was solving in JavaScript)
your implementation of
count()
has a bug, it skips the last element of the list because yourwhile(head.next)
is not entered for the penultimate element. not a kata issue.Happened to me as well. I got around it by pushing a 3 to the LL in my solution
Same issue here
Wrong test case for count. Can't submit. LL generated by running buildOneTwoThree() is 1->2->null but have a positive test for 3
Thanks for the feedback, the kata description has been updated.
Description doesn't makes its clear for getting NaN in case of '1 2 3'