Simple C++ 12ms easy understanding O(n)
class Solution {\n    public:\n        int minPatches(vector<int>& nums, int n) {\n            if (n == 0) return 0;\n            int num = nums.size();\n      
    class Solution {\n    public:\n        int minPatches(vector<int>& nums, int n) {\n            if (n == 0) return 0;\n            int num = nums.size();\n            long reach = 0;\n            int patch = 0;\n            for (int i = 0; i < num; ){\n                while (nums[i] > reach + 1){\n                    reach += (reach + 1);\n                    ++patch;\n                    if (reach >= n) return patch;\n                }\n                reach += nums[i];\n                if (reach >= n) return patch;\n                ++i;\n            }\n            while (reach < n){\n                reach += (reach + 1);\n                ++patch;\n            } \n            return patch;\n        }\n    };
[]