Easy and Concise C++
\n# Code\ncpp []\nclass Solution {\npublic:\n    ListNode* insertionSortList(ListNode* head) {\n        ListNode* ans = new ListNode(-6000);\n        while(head
\n# Code\n```cpp []\nclass Solution {\npublic:\n    ListNode* insertionSortList(ListNode* head) {\n        ListNode* ans = new ListNode(-6000);\n        while(head){\n            ListNode* curr = ans , *prev = ans;\n            while(curr and curr -> val < head -> val){\n                prev = curr;\n                curr = curr -> next;\n            }\n            prev -> next = head; \n            head = head -> next; // go to next node before linking the two parts.\n            prev -> next -> next = curr; // curr points to the node whose value is just greater than head -> val\n        }   \n        return ans -> next;\n    }\n};\n```
['C++']