You are given an integer array nums consisting of powers of target.
In a single operation, you can select any element nums[i] such that nums[i] nums, and add two occurrences of nums[i] nums.
Return the minimum number of operations required to make nums contain a subsequence whose sum is equal to target. If no such subsequence can be formed, return
Note: A subsequence is an array obtained by deleting zero or more elements from another array without altering the relative order of the remaining elements.
Constraints:
nums.length
nums[i]
nums consists only of powers of
target
You are given an integer array nums consisting of powers of target.
In a single operation, you can select any element nums[i] such that nums[i] nums, and add two occurrences of nums[i] nums.
Return the minimum number of operations required to make nums contain a subsequence whose sum is equal to target. If no such subsequence can be formed, return
Note: A subsequence is an array obtained by deleting zero or more elements from another array without altering the relative order of the remaining elements.
Constraints:
nums.length
nums[i]
nums consists only of powers of
target