Search for a command to run...
Stop slow pointer one node before the middle and skip the middle node
Initialization
slow set to 1, fast set to 3.
Tortoise and Hare Variation
1class Solution {2 deleteMiddle(head) {3 if (head === null || head.next === null) {4 return null;5 }6 7 let slow = head;8 let fast = head.next.next;9 10 while (fast !== null && fast.next !== null) {11 slow = slow.next;12 fast = fast.next.next;13 }14 15 // Deletes the middle node16 slow.next = slow.next.next;17 return head;//slow: 1fast: 318 }19}