5 Lines Easy Java Solution | 100% faster
Upvote if you Got It \uD83D\uDE42\n\nExplaination: \n1> Take two nodes,  slow and fast. \n2> Move the fast node two steps while slow node one step at a time. In
**Upvote if you Got It** \uD83D\uDE42\n\nExplaination: \n1> Take two nodes,  slow and fast. \n2> Move the fast node two steps while slow node one step at a time. In this way, fast node will move twice faster than slow node.\n3> So, when fast will reach the end then slow will reach half the distance i.e. it will reach the mid node. \n4> Return the slow node.\n\nclass Solution {\n\n    public ListNode middleNode(ListNode head) {\n        ListNode slow = head, fast = head;\n        while(fast!=null && fast.next!=null){\n            slow = slow.next;\n            fast = fast.next.next;\n        }\n        return slow;\n    }\n}\n
['Java']