Tap here to switch tabs
Problem
Submissions

Problem: Middle of the Linked List

Middle of the Linked List asks you to return the central node of a singly linked list, choosing the later of the two middle nodes whenever the list has an even number of nodes.

Statement

Given the head of a singly linked list, return the middle node of the linked list. If the number of nodes in the linked list is even, there will be two middle nodes, so return the second one.

Constraints:

Let n be the number of nodes in a linked list.

  • 1≤1 \leq n ≤100\leq 100
  • 1≤1 \leq Node.value ≤100\leq 100
  • head ≠\neq NULL
⋮
Tap here to switch tabs
Problem
Submissions

Problem: Middle of the Linked List

Middle of the Linked List asks you to return the central node of a singly linked list, choosing the later of the two middle nodes whenever the list has an even number of nodes.

Statement

Given the head of a singly linked list, return the middle node of the linked list. If the number of nodes in the linked list is even, there will be two middle nodes, so return the second one.

Constraints:

Let n be the number of nodes in a linked list.

  • 1≤1 \leq n ≤100\leq 100
  • 1≤1 \leq Node.value ≤100\leq 100
  • head ≠\neq NULL