Tag: Singly Linked List
You are asked to remove all elements of value val from a integer linked list. For example, Remove 2 from the following list, 1 -> 2 -> 2 -> …
Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list’s nodes. Only nodes itself may be changed. …
Remove the nth node from the end of a singly linked list and return its head. For example, input: 1-2-3-4-5, and n = 2. Removing the second node from …
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 …