0330. Patching Array
https://leetcode.com/problems/patching-array
Description
Given a sorted integer array nums
and an integer n
, add/patch elements to the array such that any number in the range [1, n]
inclusive can be formed by the sum of some elements in the array.
Return the minimum number of patches required.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= nums.length <= 1000
1 <= nums[i] <= 104
nums
is sorted in ascending order.1 <= n <= 231 - 1
ac
Previous0329. Longest Increasing Path in a MatrixNext0331. Verify Preorder Serialization of a Binary Tree
Last updated