Tap here to switch tabs
Problem
Submissions

Problem: Delete the Middle Node of a Linked List

med
30 min
Try to solve the Delete the Middle Node of a Linked List problem.

Statement

You are given the head of a singly linked list. Delete the middle node from the linked list and return the head of the modified linked list.

The middle node of a linked list of size nn is the ⌊n/2⌋\lfloor n / 2 \rfloorth node from the beginning using 00 based indexing, where ⌊x⌋\lfloor x \rfloor denotes the largest integer less than or equal to xx.

Constraints:

  • The number of nodes in the list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete the Middle Node of a Linked List

med
30 min
Try to solve the Delete the Middle Node of a Linked List problem.

Statement

You are given the head of a singly linked list. Delete the middle node from the linked list and return the head of the modified linked list.

The middle node of a linked list of size nn is the ⌊n/2⌋\lfloor n / 2 \rfloorth node from the beginning using 00 based indexing, where ⌊x⌋\lfloor x \rfloor denotes the largest integer less than or equal to xx.

Constraints:

  • The number of nodes in the list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5