CodeOath
← All problems

Middle of the Linked List

Easy
linked-listtwo-pointers

Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node.

Lists in this problem are given as a plain array of values, in order.

Example:

Input: head = [1,2,3,4,5]
Output: [3,4,5]  (the returned node, and everything after it)