C# | beats 99% | TC : O(n) | two-pointers | easy-understanding
\n\nTime Complexity : O(n)\nSpace Complexity : O(1)\n\nApproach:\ncreate two pointers to iterate through the linked-list, since B pointer travels twice as fast 
![image](https://assets.leetcode.com/users/images/34186300-2665-4bc5-a4db-7ee34e3ee1b2_1670205557.9473534.png)\n\nTime Complexity : O(n)\nSpace Complexity : O(1)\n\nApproach:\ncreate two pointers to iterate through the linked-list, since B pointer travels twice as fast as A pointer, A will become the middle node when B meets the end of the linked list.\n\n\n```\npublic class Solution {\n    public ListNode MiddleNode(ListNode head) {\n        //check if head is null pointer to avoid exceptions\n        if(head is null) return null;\n        \n        //fasterPtr walks twice as fast output\n        ListNode output = head;\n        ListNode fasterPtr = head.next;\n        \n        //loop through the linked list until fasterPtr becomes null-pointer\n        while(fasterPtr is not null)\n        {\n            output = output.next;\n            //check if it has become null to avoid exception (happens with even length)\n            fasterPtr = fasterPtr.next;\n            if(fasterPtr is not null)\n                fasterPtr = fasterPtr.next;\n        }\n        \n        return output;\n    }\n}\n```
['Linked List', 'Two Pointers', 'C#']