Simple || Easy to Understand || Clear
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int minPatches(int[] nums, int n) {\n        int minPatch = 0, i = 0;\n        long max = 1;\n\n        while(max <= n) {\n\n            if(i < nums.length && nums[i] <= max) max += nums[i++];\n            else {\n                minPatch++;\n                max += max;\n            }\n        }\n\n        return minPatch;\n    }\n}\n\n\n```
['Java']