Actually patching
int minPatches(vector<int>& nums, int n) {\n        int k = nums.size();\n        for (long miss=1, i=0; miss<=n; miss+=nums[i++])\n            if (i == nums.si
    int minPatches(vector<int>& nums, int n) {\n        int k = nums.size();\n        for (long miss=1, i=0; miss<=n; miss+=nums[i++])\n            if (i == nums.size() || nums[i] > miss)\n                nums.insert(nums.begin()+i, miss);\n        return nums.size() - k;\n    }\n\nO(k\xb7log(n)) instead of O(k+log(n)), but not too bad.
[]