Two Swift 4ms clean solutions
Solution #1: O(n)\n\nConverting LinkList to an Array in O(n).\nThen using simple math we can return the center array element.\n\n\nfunc middleNode(_ head: ListN
#### Solution #1: O(n)\n\nConverting LinkList to an Array in O(n).\nThen using simple math we can return the center array element.\n\n```\nfunc middleNode(_ head: ListNode?) -> ListNode? {\n    var found = [ListNode?]()\n\tvar node = head\n\t\n    while(node != nil) {\n        found.append(node)\n        node = node?.next\n    }\n\t\n    return found[found.count/2]\n}\n```\n\n#### Solution #2: O(n/2)\n\nUsing a fast/slow pointer, the fast pointer moves 2 nodes ahead in one loop while the slow pointer moves one node in the same time.\nBy the time the fast pointer reaches the end, the slow pointer is half-way across, i.e. at the center, which we need to return.\n\n```\nfunc middleNode(_ head: ListNode?) -> ListNode? {\n    var (fast,slow) = (head, head)\n\t\n    while(fast?.next != nil) {\n        fast = fast?.next?.next\n        slow = slow?.next\n    }\n\t\n    return slow\n}\n```
['Swift']