Very Easy C++ Code (Explained)
\tSteps:\n   Please upvote if you find it helpful .\n\tEvery Interation we can have either of the three conditions:\n\tWe keep interating unitll our reach>=n\n\
# \tSteps:\n   Please upvote if you find it helpful .\n\tEvery Interation we can have either of the three conditions:\n\tWe keep interating unitll our **reach>=n**\n\t\n\t1. If my current number is less than or equal to reach, then add that to the reach and move i forward.\n\t2. If my current element, nums[i] is greater than the current reach then we search for the smallest number we should add to make the current element in reach, which is going to be  (reach+1).\n\t3. If we surpass the array boundary i.e. i>nums.size(), we are again going to look for the smallest element we can add to reach the desired target n. This smallest number is going to be again (reach+1).\n```\nclass Solution {\npublic:\n    int minPatches(vector<int>& nums, int n) {\n        int count=0;\n        long long reach=0;\n        int i=0;\n        while(reach<n){\n            if(i>=nums.size()){\n                reach+=reach+1;\n                count++;\n            }\n            else if(i<nums.size() && nums[i]<=reach+1){\n                reach+=nums[i];\n                i++;\n            }\n            else {\n                reach+=reach+1;\n                count++;\n            }\n        }\n        return count;\n    }\n};\n```
[]