💯JAVA Solution Explained in HINDI
https://youtu.be/Qk1elv8QGj0\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote 
https://youtu.be/Qk1elv8QGj0\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote the solution if you liked it.\n\n# Subscribe:- [ReelCoding](https://www.youtube.com/@reelcoding?sub_confirmation=1)\n\nSubscribe Goal:- 500\nCurrent Subscriber:- 440\n\n# Complexity\n- Time complexity: O(m+logn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minPatches(int[] nums, int n) {\n        long minNumberPatches = 0, maxNumber = 0;\n        int i = 0, len = nums.length;\n\n        while (maxNumber < n) {\n            if (i < len && maxNumber + 1 >= nums[i]) {\n                maxNumber += nums[i];\n                i++;\n            } else {\n                minNumberPatches++;\n                maxNumber += (maxNumber + 1);\n            }\n        }\n        return (int) minNumberPatches;\n    }\n}\n```
['Java']