Short C# Solution
\n    public class Solution\n    {\n        public int MinPatches(int[] nums, int n)\n        {\n            checked\n            {\n                (long from,
```\n    public class Solution\n    {\n        public int MinPatches(int[] nums, int n)\n        {\n            checked\n            {\n                (long from, long to) range = (1, 1);\n                int res = 0;\n                int idx = 0;\n\n                while (n >= range.to)\n                {\n                    if (idx < nums.Length && nums[idx] <= range.to)\n                    {\n                        range = (range.from, range.to + nums[idx]);\n                        idx++;\n                    }\n                    else\n                    {\n                        res++;\n                        range = (range.from, 2 * range.to);\n                    }\n                }\n\n                return res;\n            }\n        }\n    }\n```
[]