Leetcode, Interval, Interview Questions, Google, Meta.
the left end would be the right end of the last open tap in the stack. For the i-th tap, first pop from the stack all taps for which the left end ≥ i-A[i], then add the i-th tap to the end of S. The i-th tap is not opened if the right end of the last open tap in the stack S ≥ i+A[i]. Time