Best Explanation Ever  \(@^0^@)/
\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val)
```\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val) { this.val = val; }\n *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }\n * }\n */\nclass Solution {\n    public void reorderList(ListNode head) {\n        if(head==null||head.next==null)return ;\n        \n        //Find the middle of the list\n        ListNode slow = head;//slow head pe\n        ListNode fast = head.next;//fast head.next se\n        while(fast!=null&&fast.next!=null){//slow humare middle pe poch jayega\n            slow = slow.next;\n            fast = fast.next.next;\n        }\n        \n        //Reverse the half after middle  1->2->3->4->5->6 to 1->2->3->6->5->4\n        ListNode second =slow.next;//Second is At the starting point of second half\n        ListNode prev = null;\n        slow.next = null;//last node of first half pointing to null\n        while(second!=null){// basic reversing function\n            ListNode forw = second.next;\n            second.next = prev;\n            prev =second;\n            second = forw;\n        }\n        \n        //give output as prev as the head of the reverse linked list\n        //Start reorder one by one  1->2->3->6->5->4 to 1->6->2->5->3->4\n        \n        \n        ListNode first = head;//first pointer at the head of first list\n        second = prev;//second pointet at the head of the second reverse list\n        while(second!=null){//merging function\n            ListNode temp1=first.next;//temp1 to store the next value of first half\n            ListNode temp2 = second.next;//temp 2 to store the next value of second half\n            first.next = second;\n            second.next =temp1;\n            first = temp1;//reseting first\n            second = temp2;//resenting second\n        }\n    }\n}  \n```\n<hr>\n<hr>\n\n***TIME COMPLEXITY = 0(N)\nSPACE COMPLEXITY =O(1)*\n\n<hr>\n<hr>\n
[]