JAVA Solution | Beats 95%  Space&Time Complexity |
Intuition\n Describe your first thoughts on how to solve this problem. \n- Since the minimum poision time would me the duration given(because ashe would always 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Since the minimum poision time would me the duration given(because ashe would always be poisioned for "duration" for the last value in timeSeries array).\n- Now if ,during the time when ashe was hit , she was already poisined , It means she was only poisened for the union of the two time lapses.\n- Which is further calculated in Poision time. \n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n\n# Complexity\n- Time complexity: O(n)\nN is the number of time ashe was poisioned.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n![image.png](https://assets.leetcode.com/users/images/b5f076c7-e043-4578-9e24-90844007b0a5_1685167008.9423625.png)\n\n# Code\n```\nclass Solution {\n    public int findPoisonedDuration(int[] timeSeries, int duration) {\n        int poision=duration;\n        for(int i=1;i<timeSeries.length;i++){\n            if(timeSeries[i-1]+duration>timeSeries[i]){\n                poision=poision+timeSeries[i]-timeSeries[i-1];\n            }else {\n                poision+=duration;\n            }}\n        return poision;\n    }\n}\n```\n# An Upvote will be encouraging \uD83D\uDC4D
['Array', 'Simulation', 'Java']