✔️ 100% Fastest Swift Solution, time: O(n), space: O(1).
\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     public var val: Int\n *     public var next: ListNode?\n *     public init() { 
```\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     public var val: Int\n *     public var next: ListNode?\n *     public init() { self.val = 0; self.next = nil; }\n *     public init(_ val: Int) { self.val = val; self.next = nil; }\n *     public init(_ val: Int, _ next: ListNode?) { self.val = val; self.next = next; }\n * }\n */\nclass Solution {\n   // - Complexity:\n    //   - time: O(n), where n is the number of nodes in the linked list.\n    //   - space: O(1), only constant space is used.\n    \n    func reorderList(_ head: ListNode?) {\n        guard head != nil else { return }\n\n        var slow = head\n        var fast = head\n\n        while fast?.next != nil {\n            slow = slow?.next\n            fast = fast?.next?.next\n        }\n\n        let reversedList = reverseList(slow)\n        mergeLists(head, reversedList)\n    }\n    \n\n    private func reverseList(_ head: ListNode?) -> ListNode? {\n        var prev: ListNode? = nil\n        var curr = head\n        var next: ListNode? = nil\n\n        while curr != nil {\n            next = curr?.next\n\n            curr?.next = prev\n            prev = curr\n            curr = next\n        }\n\n        return prev\n    }\n    \n\n    private func mergeLists(_ first: ListNode?, _ second: ListNode?) {\n        var first = first\n        var second = second\n        var tmp: ListNode? = nil\n\n        while second?.next != nil {\n            tmp = first?.next\n            first?.next = second\n            first = tmp\n\n            tmp = second?.next\n            second?.next = first\n            second = tmp\n        }\n    }\n\n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['Swift']