Central Linked List
Given a singly linked list node
, return the value of the middle node. If there’s two middle nodes, then return the second one.
Bonus: Solve using \(\mathcal{O}(1)\) space.
Constraints
n ≤ 100,000
wheren
is the number of nodes innode
https://binarysearch.com/problems/Central-Linked-List
Examples
Example 1
Input
- node =
Output
- answer =
1
Leave a comment