Python solution faster than 97% with explanation
\n you just need to figure out one thing:\n if you can sum up from 1 to 10, what happen if you have another number\n suppose this number is 2, then you can sum 
\n* you just need to figure out one thing:\n* if you can sum up from 1 to 10, what happen if you have another number\n* suppose this number is 2, then you can sum up from 1 to 12\n* suppose this number is 11, then you can sum up from 1 to 21 \n* suppose this number is 12, then you can\'t get 11 and the consecutive sum is broken at 11\n* suppose this number is 100, then you can\'t get the sum from 11 to 99\n* so we know if you can sum up from 1 to k, the next largest number you can have is k+1, otherwise the consecutive sum will be invalid\n* traverse from left, if the current number x is lower than or equal to k+1, let k = k+x, otherwise let k = k+1(k+1 is the largest we can have to keep the sum valid)\n\nclass Solution:\n\n    def minPatches(self, nums: List[int], n: int) -> int:\n        ans = cum = index = 0 \n        while(cum<n):\n            if index<len(nums):\n                if cum+1<nums[index]:\n                    cum+=cum+1\n                    ans+=1\n                else:\n                    cum+=nums[index]\n                    index+=1     \n            else:\n                cum += cum+1\n                ans+=1\n\n        return ans
['Python']