Beats 100➡️Full In depth Explain 💯➡️[Java/C++/Python3/JavaScript/C#/Go/Rust]
Intuition\n1. Just imagine you are into a 100meter race representing your country.\n2. Usian bolt is running with twice the speed of yours.\n3. When Usian bolt 
# Intuition\n1. Just imagine you are into a 100meter race representing your country.\n2. Usian bolt is running with twice the speed of yours.\n3. When Usian bolt will touch the finish line, where you will be?\nYou will be in the middle of the track.\n4. Here you go, now you are ready ot solve the quesiton.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. **Null Check:**\n    - If the `head` of the linked list is `null`, return `null`, as there are no nodes in the list.\n2. **Initialize Pointers:**\n    - Initialize two pointers, `fast` and `slow`, both pointing to the `head` of the linked list.\n3. **Traverse the List:**\n    - While the fast pointer and its next node (fast.next) are not null (indicating there are still nodes to traverse):\n        - Move the `slow` pointer one step forward (`slow = slow.next`).\n        - Move the `fast` pointer two steps forward (`fast = fast.next.next`).\n4. **Return the Middle Node:**\n    - Once the loop exits, the slow pointer will be at the middle node of the list.\n    - Return the node pointed to by the slow pointer, which represents the middle node of the linked list.\n5. **Edge Case Handling:**\n    - If the input linked list is empty, return `null`.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```Java []\nclass Solution {\n    public ListNode middleNode(ListNode head) {\n        if(head == null) {\n            return head;\n        }   \n\n        ListNode fast = head;\n        ListNode slow = head;\n\n        while(fast!=null && fast.next!=null) {\n            slow = slow.next;\n            fast = fast.next.next;\n        }\n        return slow;\n    }\n}\n```\n```C++ []\nclass Solution {\npublic:\n    ListNode* middleNode(ListNode* head) {\n        if (head == nullptr) {\n            return head;\n        }   \n\n        ListNode* fast = head;\n        ListNode* slow = head;\n\n        while (fast != nullptr && fast->next != nullptr) {\n            slow = slow->next;\n            fast = fast->next->next;\n        }\n        return slow;\n    }\n};\n```\n```Python3 []\nclass Solution:\n    def middleNode(self, head: ListNode) -> ListNode:\n        if not head:\n            return head\n        \n        fast = head\n        slow = head\n\n        while fast and fast.next:\n            slow = slow.next\n            fast = fast.next.next\n\n        return slow\n```\n```Rust []\nimpl Solution {\n    pub fn middle_node(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {\n        let (mut fast, mut slow) = (head.clone(), head);\n\n        while let (Some(node1), Some(node2)) = (fast, slow.clone()) {\n            if node2.next.is_none() {\n                return node1.next;\n            }\n            slow = node2.next;\n            fast = node1.next.unwrap().next;\n        }\n        slow\n    }\n}\n```\n```go []\nfunc middleNode(head *ListNode) *ListNode {\n    if head == nil {\n        return head\n    }\n    fast := head\n    slow := head\n\n    for fast != nil && fast.Next != nil {\n        slow = slow.Next\n        fast = fast.Next.Next\n    }\n    return slow\n}\n```\n```C# []\npublic class Solution {\n    public ListNode MiddleNode(ListNode head) {\n        if (head == null) {\n            return null;\n        }   \n\n        ListNode fast = head;\n        ListNode slow = head;\n\n        while (fast != null && fast.next != null) {\n            slow = slow.next;\n            fast = fast.next.next;\n        }\n        return slow;\n    }\n}\n```\n```JavaScript []\nvar middleNode = function(head) {\n    if (!head) {\n        return null;\n    }\n    \n    let fast = head;\n    let slow = head;\n    \n    while (fast && fast.next) {\n        slow = slow.next;\n        fast = fast.next.next;\n    }\n    \n    return slow;\n};\n```\n---\n\n\n---\n\n![5c63d377-8ef4-4beb-b09d-0edb07e09a41_1702955205.6568592.png](https://assets.leetcode.com/users/images/d526b1ed-fb66-4969-8fea-de0ade9cc20f_1709792333.9498603.png)\n
['Two Pointers', 'Python', 'C++', 'Java', 'Go', 'Python3', 'Rust', 'JavaScript', 'C#']