题目:

题解:
int minPatches(int* nums, int numsSize, int n) {
int patches = 0;
long long x = 1;
int index = 0;
while (x <= n) {
if (index < numsSize && nums[index] <= x) {
x += nums[index];
index++;
} else {
x <<= 1;
patches++;
}
}
return patches;
}













![[器械财讯]威高血液净化:中国血液透析市场的领军企业冲刺IPO](https://img-blog.csdnimg.cn/img_convert/4f06871a3c97cefa99b2da779a45b207.jpeg)





