Python easy to understand solution
```\n    def minPatches(self, nums: List[int], n: int) -> int:\n        prevNum=0\n        patches=0\n        i=0\n        while i=n): return patches\n         
```\n    def minPatches(self, nums: List[int], n: int) -> int:\n        prevNum=0\n        patches=0\n        i=0\n        while i<len(nums):\n            num=nums[i]\n            if(prevNum>=n): return patches\n            if(num<=prevNum+1):\n                prevNum=prevNum+num\n                i+=1\n            else:\n                patches+=1\n                prevNum=prevNum+prevNum+1\n        if(prevNum<n):\n            while prevNum<n:\n                patches+=1\n                prevNum+=prevNum+1\n        return patches
[]