#3355
Zero Array Transformation I
specialist · 810 · lc medium +31 · 54.4% accepted · 848 likes · top 47%
Description
You are given an integer array nums of length n and a 2D array queries, where queries[i] = [li, ri].
For each queries[i]:
- Choose any subset of indices in the range [li, ri].
- Decrement the values at those indices by 1.
A Zero Array has all elements equal to 0.
Return true if nums can be reduced to a Zero Array after processing all queries in order, otherwise return false.
Code
1
2
3