var oddEvenList = function(head) {
if (!head || !head.next) return head;
let oddNode = head;
const evenHead = head.next;
let evenNode = head.next;
while(evenNode?.next) {
oddNode.next = evenNode.next;
oddNode = oddNode.next;
evenNode.next = oddNode.next;
evenNode = evenNode.next;
}
oddNode.next = evenHead;
return head;
};
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)