An attacking character inflicts a poison condition on a target. When an attack lands at second t, the target remains poisoned for duration seconds, covering the inclusive time interval duration seconds starting from the timestamp of the new attack.
You are given an integer array timeSeries sorted in nondecreasing order, where timeSeries[i] represents the second at which an attack lands, along with an integer duration.
Return the total number of seconds that the target remains poisoned.
Constraints:
timeSeries.length
timeSeries[i], duration
timeSeries is sorted in nondecreasing order.
An attacking character inflicts a poison condition on a target. When an attack lands at second t, the target remains poisoned for duration seconds, covering the inclusive time interval duration seconds starting from the timestamp of the new attack.
You are given an integer array timeSeries sorted in nondecreasing order, where timeSeries[i] represents the second at which an attack lands, along with an integer duration.
Return the total number of seconds that the target remains poisoned.
Constraints:
timeSeries.length
timeSeries[i], duration
timeSeries is sorted in nondecreasing order.