Neat and clean code|| no need of explanation
Write the space complexity in the comment section. I will update it later. Let\'s see whose answer is correct.\n# Complexity\n- Time complexity:O(n)\n Add your 
# Write the space complexity in the comment section. I will update it later. Let\'s see whose answer is correct.\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n``` c++ []\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* reverse(ListNode* head){\n        ListNode*prev=NULL,*next=head;\n        while(head){\n            next=head->next;\n            head->next=prev;\n            prev=head;\n            head=next;\n        }\n        return prev;\n    }\n\n    ListNode* merge(ListNode* h1,ListNode* h2){\n        if(h1==NULL)return h2;\n        if(h2->next==NULL)return h1;\n        h1->next=merge(h2,h1->next);\n        return h1;\n    }\n\n    ListNode* findmid(ListNode* head){\n        ListNode* slow=head,*fast=head;\n        while(fast&&fast->next){\n            slow=slow->next;\n            fast=fast->next->next;\n        }\n        return slow;\n    }\n    void reorderList(ListNode* head) {\n        if(head==NULL||head->next==NULL)return;\n\n        ListNode* mid=findmid(head);\n        ListNode* head_of_revll=reverse(mid);\n        merge(head,head_of_revll);\n    }\n};\n```\n
['C++']