Simple solution with Python3
Intuition\nYou are a hero. You should attack an enemy. You have a list of attacks, and you attack him by A[i] second for duration to let him be poisoned.\nYour 
# Intuition\nYou are a hero. You should attack an enemy. You have a list of attacks, and you attack him by `A[i]` second for `duration` to let him be **poisoned**.\nYour goal is to calculate **how much** time an enemy **will be poisoned**.\nPS: poison will **reset** when you try attack an enemy **before** previous poison will disappear.\n\n# Approach\nFor each `A[i]` define, if you have enough time to kick an enemy as `min(duration, A[i + 1] - A[i])`.\n\n# Complexity\n- Time complexity: **O(N)**\n\n- Space complexity: **O(1)**\n\n# Code\n```\nclass Solution:\n    def findPoisonedDuration(self, A: list[int], duration: int) -> int:\n        ans = 0\n\n        for i in range(len(A) - 1):\n            ans += min(duration, A[i + 1] - A[i])\n\n        return ans + duration\n```
['Python3']