python-ds icon indicating copy to clipboard operation
python-ds copied to clipboard

adding an edge case missed in linked list remove_nth_node_from_end.py

Open sshsrijanr opened this issue 1 year ago • 0 comments

Case when the length of the linked list and N is equal

Description

In the Linked List Problem of Removing nth Node from the End, One of the cases was missed where the length of the linked list is equal to n, In this case, the current code throws AttributeError: 'NoneType' object has no attribute 'next'

Fixes # (issue)

  1. Adding an extra node in front
  2. Return value from function remove was not assigned to head

Type of change

  • [*] Bug fix (non-breaking change which fixes an issue)

sshsrijanr avatar Oct 02 '24 17:10 sshsrijanr