🔥Python3🔥 Two pointers
\nNaive approach (2 passes)\n(1) Going through the Linked List once to find its length.\n(2) Going through it again but only half way.\npython\nclass Solution:\
\n**Naive approach (2 passes)**\n(1) Going through the Linked List once to find its length.\n(2) Going through it again but only half way.\n```python\nclass Solution:\n    def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        res = head\n        l = 0\n        while head:\n            head = head.next\n            l += 1\n        mid = l//2\n        while mid:\n            res = res.next\n            mid -= 1\n        return res\n```\n\n**Two pointers (1 pass)**\n(1) Having two pointers ```fast``` and ```slow```, where ```fast``` will move two steps each time, and ```slow``` will move one step each time.\n(2) At the time fast went to the end, ```slow``` will be our result.\n(Draw it out using odd and even length linked lists to fully understand if you have doubts (This technique is very usefull for other questions such as [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/)))\n\n```python\nclass Solution:\n    def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        fast = slow = head\n        while fast and fast.next:\n            fast = fast.next.next\n            slow = slow.next\n        return slow\n```\n\n**Linked list questions from [Blind 75](https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions)**\n - [Reverse Linked List (easy)](https://leetcode.com/problems/reverse-linked-list/)\n - [Merge Two Sorted Lists (easy)](https://leetcode.com/problems/merge-two-sorted-lists/)\n - [Reorder List (medium)](https://leetcode.com/problems/reorder-list/)\n\n - [Linked List Cycle (easy)](https://leetcode.com/problems/linked-list-cycle/)\n - [Remove Nth Node From End of List (medium)](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)\n - [Merge k Sorted Lists (hard)](https://leetcode.com/problems/merge-k-sorted-lists/)\n\n**Upvote** if you like this post.\n\n**Connect with me on [LinkedIn](https://www.linkedin.com/in/meida-chen-938a265b/)** if you\'d like to discuss other related topics\n\n\uD83C\uDF1F If you are interested in **Machine Learning** || **Deep Learning** || **Computer Vision** || **Computer Graphics** related projects and topics, check out my **[YouTube Channel](https://www.youtube.com/@meidachen8489)**! Subscribe for regular updates and be part of our growing community.
[]