我们的英雄Teemo正在用毒药攻击敌人阿什!当Teemo攻击阿什时,阿什被毒药毒,持续时间为准数秒.更正式地说, t秒的攻击意味着阿什在包括时间间隔 [t,t + 持续时间 - 1]中被毒.如果Teemo在毒药效应结束之前再次攻击,则重新设置计时器,毒药效应在新攻击后的秒结束.你得到一个不减少的整数数组timeSeries,其中timeSeries[i]表示Teemo第二次攻击阿什Series[i],以及整数持续时间.返回阿什被毒药的总秒数.
To solve this problem, we can iterate over the timeSeries and calculate the difference between the current and previous attack times. If the difference is less than the duration, the poison effect will last for the difference time. If the difference is greater than or equal to the duration, the poison effect will last for the duration time. We can then add up all the poison effect durations to get the total number of seconds Ashe is poisoned. Here's the code:

```
def findPoisonedDuration(timeSeries, duration):
    total_duration = 0
    for i in range(len(timeSeries)):
        if i == 0:
            total_duration += duration
        else:
            diff = timeSeries[i] - timeSeries[i-1]
            total_duration += min(diff, duration)
    return total_duration
```

Example usage:

```
timeSeries = [1,4,7,10]
duration = 3
print(findPoisonedDuration(timeSeries, duration))  # Output: 9
```

In this example, Teemo attacks Ashe at seconds 1, 4, 7, and 10. The poison effect lasts for 3 seconds each time. At second 1, the poison effect lasts for the full duration of 3 seconds. At second 4, the poison effect lasts for 3 seconds (until second 6). At second 7, the poison effect lasts for 3 seconds (until second 9). At second 10, the poison effect lasts for the full duration of 3 seconds. So the total duration of the poison effect is 9 seconds.