Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Created June 24, 2020 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsitallapudi/fdaed03a18ec16ff8073dd24ebb4b4ce to your computer and use it in GitHub Desktop.
Save vamsitallapudi/fdaed03a18ec16ff8073dd24ebb4b4ce to your computer and use it in GitHub Desktop.
def delete_at_end(head):
if not head:
return None
prev_node = head
while prev_node.next.next:
prev_node = prev_node.next
prev_node.next = None
return head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment