2 Way solve using C++ beats 100%
Method 1\n## Intuition\n Describe your first thoughts on how to solve this problem. \nFamously known as heir and tortoise technique\n## Approach\n Describe your
# Method 1\n## Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFamously known as heir and tortoise technique\n## Approach\n<!-- Describe your approach to solving the problem. -->\nCreate two pointers one fast and one slow then move the fast pointer 2 steps until its own or the next of its node become null.\n## Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n## Code\n```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    ListNode* middleNode(ListNode* head) {\n        ListNode* slow = head;\n        ListNode* fast = head;\n\n        while(fast && fast->next){\n            fast = fast->next->next;\n            slow = slow->next;\n        }\n        return slow;\n    }\n};\n```\n# Method 2\n\n## Intuition\nWe will get the length of the linkedlist first and then will iterate the linked list to its half length and in this approach it covers all the edge cases here\n\n## Time Complexity\n    O(n)\n## Space Complexity\n    O(1) but it takes a space to store 1 integer\n\n## Code\n```\nclass Solution {\npublic:\n    ListNode* middleNode(ListNode* head) {\n        ListNode* temp = head;\n        int len = 0;\n        while(temp != NULL){\n            temp = temp->next;\n            len++;\n        }\n        len = len/2;\n\n        for(int i=0; i<len;i++){\n            head = head->next;\n        }\n        return head;\n    }\n};\n```\n### Hope it helps someone
['C++']