Question expects the wrong answer


  • 0
    C

    The question states that for the linked list 1->2->3->4->5 and n = 2, that it should return 4, thus making the list 1->2->3->5. That's fine and dandy. However, when I submitted my solution and it tested it for the linked list 1->2 and n = 1, it said that the output should be 1. Am I missing something here or is the question's example wrong?


  • 1
    S

    Basically it expects the nth element from the end to be removed. So for {1,2} and n = 1 it should remove 2 and return {1} as LL.


  • 0
    C

    Oh jeez. I just saw that the question said for return value to be the head! I thought the return value was the removed node. Should brush up on my reading skills, eh? lol.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.