C++ Simple and Easy Explained Solution, 7-Short-Lines
Idea:\nEvery time count reaches a number that the next element in nums is greater than it, we need a patch.\nIf we add the number itself, count can be doubled b
**Idea:**\nEvery time `count` reaches a number that the next element in `nums` is greater than it, we need a patch.\nIf we add the number itself, `count` can be doubled because we can add the new number to any of the previous numbers.\nSo if `count` = 7, and the next number in `nums` is 10, if we add 7 to `nums` now we have all numbers until 14.\n```\nclass Solution {\npublic:\n    int minPatches(vector<int>& nums, int n) {\n        long patches = 0, count = 1, i = 0, sz = nums.size();\n        while (count <= n) {\n            \n            if (i < sz && nums[i] <= count) count += nums[i++];\n            \n            else {\n                count *= 2;\n                patches++;\n            }\n        }\n        \n        return patches;\n    }\n};\n```\n**Like it? please upvote!**
['C']