https://leetcode.com/problems/insertion-sort-list



Runtime: 12 ms, faster than 96.34% of C++ online submissions for Insertion Sort List.
Memory Usage: 9.8 MB, less than 13.87% of C++ online submissions for Insertion Sort List.



```cpp
class Solution {
public:
    ListNode* insertionSortList(ListNode* head) {
        //8:07
        ListNode* node = head;
        vector<int> l;
        while (node != nullptr) {
            l.push_back(node->val);
            node = node->next;
        }
        
        sort(l.begin(), l.end());
        
        int i = 0;
        node = head;
        while (node != nullptr) {
            node->val = l[i];
            i += 1;
            node = node->next;
        }
        
        return head;
        //8:09
    }
};
```