892. Delete Tail of Doubly Linked List
Given the head of a doubly linked list, remove the node at the tail of the linked list and return the head of the modified list.
The tail is the last node of the linked list.
Example 1:
Input: head = [1, 2, 3]
Output: head = [1, 2]
Explanation:
- The node with value 3 was removed.
Example 2:
Input: head = [7]
Output: head = [ ]
Explanation:
- Note that the head has null value after the removal.
Now Your Turn!
Pick the correct output for the given inputInput: head = [2, 4]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- n == Number of nodes in the linked list
- 1 <= n <= 100
- 0 <= ListNode.val <= 100