knaxus/problem-solving-javascript

addAt function in linked-list

TheSTL opened this issue · 5 comments

Linked-list addAt function not working properly.
File location linked-list

Please go through the Contribution Guide here https://github.com/knaxus/problem-solving-javascript#contribution-guide before going forward with this issue.

Thanks

This appears to be working correctly in master (there's a passing test too). What's the issue?

@fluffynuts

  • Case 1:
    linkedList.addAt(0, 1);
    linkedList.addAt(0 ,2);
    output : { data: 1, next: Node { data: 2, next: null } }
  • Case 2:
    linkedList.addAt(0, 1);
    linkedList.addAt(0 ,2);
    linkedList.addAt(2 ,3);
    output: { data: 1, next: Node { data: 3, next: null } }

There can be more cases where it can fail

Hey Can I take this issue.

ok