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≤
n ≤100
- 1≤
Node.value ≤100
head = NULL
So far, you have probably brainstormed some approaches and have an idea of how to solve this problem. Let’s explore some of ...