Simple java code
\n# Complexity\n- \n\n# Code\n\nclass Solution {\n    public int findPoisonedDuration(int[] arr, int d) {\n        int n=arr.length;\n        int sum=0;\n      
\n# Complexity\n- \n![image.png](https://assets.leetcode.com/users/images/862441eb-b5b6-4214-ae73-3acea6629d34_1703040849.0732398.png)\n# Code\n```\nclass Solution {\n    public int findPoisonedDuration(int[] arr, int d) {\n        int n=arr.length;\n        int sum=0;\n        for(int i=0;i<n-1;i++){\n            if(arr[i]+d<arr[i+1]){\n                sum=sum+d;\n            }\n            else{\n                sum=sum+(arr[i+1]-arr[i]);\n            }\n        }\n        sum=sum+d;\n        return sum;\n    }\n}\n```
['Java']