class Solution { func middleNode(_ head: ListNode?) -> ListNode? { var fast = head var slow = head while (fast != nil && fast!.next != nil) { fast = fast!.next!.next slow = slow!.next } return slow }}
Runtime 6 ms Beats 54.85%
Memory 14 MB, Beats 70.57%
Comments0
No comments yet. Be the first to share your thoughts.