Ad
  • Custom User Avatar

    For me, it was becuase I wasn't following the requirement for my lists to share 'as many nodes as possible with orig' in a particular circumstance.

  • Default User Avatar

    An articulated and helpful comment, even if it were criticism, is always welcome, thanks! :)

  • Custom User Avatar

    parseInt isn't required here, (Integer. str) (with a space after the ., for some reason the space is getting removed in my comment) gets the job done. parseInt would avoid errors if there are any letters in the middle of the string, but knowing that the inputs will always be numerical makes this unneccessary. Not a criticism, just a comment

  • Custom User Avatar

    This is issue is definitely related to the EmptyList at the end of the LL being changed. If you run into this issue make sure it isn't being modified anywhere. Don't just check your remove method. That test really needs to be updated to be more clear.

  • Custom User Avatar

    I am having the same exact issue. I am returning EmptyNode from the tail as tiagorg suggested. I used narve's test specs above with an additional one shown below to make sure it was the empty node from the tail.

    Test.expect( list1.tail() === list1.remove(list1.head()) )

    Any other ideas about why it might not be passing?

  • Custom User Avatar

    I'm still having this issue and it's definitely returning the same EmptyNode from the tail node.Can't figure out what the hell else it's expecting.

  • Custom User Avatar

    I was having this same thing. The issue is that I was always returning a new EmptyNode while this test is expecting it to be the same EmptyNode from the tail node.

  • Default User Avatar
  • Custom User Avatar

    Nice kata, although some more instructions would've been handy. Now I have only 1 test case that fails when I try to submit, and this is an extremely simple one:

    Removing 'a' from '(a)': 
       l1.remove(first) is empty
    

    WTF does this mean? Of course, removing 'a' from (a) gives an empty list in my code... I have this testcase myself (which passes):

    list1 = new ListNode( 'a' );
    Test.expect( list1.remove(list1.head()).isEmpty());
    Test.expect( list1.remove('a').isEmpty());
    

    Any tips? Or can somebody (the author?) please paste the code for this failing test case?