← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an integer array nums of length n and a 2D integer array queries, where queries[i] = [li, ri, vali].
For every index j such that li <= j <= ri, you may decrease nums[j] by any integer amount between 0 and vali (inclusive). The amount chosen at each index can differ.
Return true if it is possible to transform nums into a Zero Array (an array where every element is 0) after applying all queries; otherwise return false.
Each index in [0, 2] can be decremented by up to 1. Subtract 1 at indices 0 and 2 to get [0, 0, 0].
The total decrement budget at index 0 is 1, but nums[0] is 4, so it can never reach 0.