2674. Split a Circular Linked List
Given a circular linked list
list
of positive integers, your task is to split it into 2 circular linked lists so that the first one contains the first half of the nodes inlist
(exactlyceil(list.length / 2)
nodes) in the same order they appeared inlist
, and the second one contains the rest of the nodes inlist
in the same order they appeared inlist
.Return an array answer of length 2 in which the first element is a circular linked list representing the first half and the second element is a circular linked list representing the second half.
A circular linked list is a normal linked list with the only difference being that the last node’s next node, is the first node.
1 | /** |