You are given an integer array nums and a list of range queries queries, where each query queries[i] = [l_i, r_i] represents an operation that can be applied at most once.
When you apply a query [l_i, r_i], you choose an integer decrement amount for each index j in the range l_i \leq j \leq r_i, and subtract that amount from nums[j]. Each chosen decrement must be non negative, and after all applied queries, every element of nums must be exactly
You may remove some queries and keep the rest. Return the maximum number of queries you can remove such that it is still possible to convert nums into a zero array using the remaining queries. If it is impossible to convert nums into a zero array even when using all queries, return
Note: Each query provides at most
unit of total decrement capacity per index in its range, and you may distribute that capacity independently across indices.
Constraints:
nums.length
nums[i]
queries.length
queries[i].length
l_i r_i nums.length
You are given an integer array nums and a list of range queries queries, where each query queries[i] = [l_i, r_i] represents an operation that can be applied at most once.
When you apply a query [l_i, r_i], you choose an integer decrement amount for each index j in the range l_i \leq j \leq r_i, and subtract that amount from nums[j]. Each chosen decrement must be non negative, and after all applied queries, every element of nums must be exactly
You may remove some queries and keep the rest. Return the maximum number of queries you can remove such that it is still possible to convert nums into a zero array using the remaining queries. If it is impossible to convert nums into a zero array even when using all queries, return
Note: Each query provides at most
unit of total decrement capacity per index in its range, and you may distribute that capacity independently across indices.
Constraints:
nums.length
nums[i]
queries.length
queries[i].length
l_i r_i nums.length