GREAT JAVA EXPLAINATION
class Solution {\n    public void reorderList(ListNode head) {\n      Stack s=new Stack<>();\n        ListNode curr=head; //take pointer to store address of hea
# class Solution {\n    public void reorderList(ListNode head) {\n      Stack<ListNode> s=new Stack<>();\n        ListNode curr=head; //take pointer to store address of head\n        int c=0;\n        while(curr!=null)\n        {\n            s.push(curr);   //push address of head in stack\n            curr=curr.next;\n            c++;          //count elements in stack or list\n        }\n       curr=head;          //refer example at end for great explaination\n        for(int i=0;i<(c/2);i++)     //the loop is run to the half of the list to connect the list and stack\n        {\n            ListNode temp=curr.next;  //take temp= address of value 2\n            ListNode end=s.pop();    //take address of 4 in end node\n            curr.next=end;           //connect 1 with end (4)\n            end.next=temp;           //connect end(4) with temp(2)\n            curr=temp;               //pass address of temp to current to repeat the process till the end of list\n        }\n        curr.next=null;\n    }\n}\n// Input: head = [1,2,3,4]\n// Output: [1,4,2,3]
['Stack', 'Java']