java 1 line Solution | and 7 line solution with explanantion
if you like it kindly upvote \n\nclass Solution {\n    public int findPoisonedDuration(int[] nums, int d) {\n        int ans=d;\n        for(int i=1;i<nums.leng
if you like it kindly upvote \n```\nclass Solution {\n    public int findPoisonedDuration(int[] nums, int d) {\n        int ans=d;\n        for(int i=1;i<nums.length;i++){  \n          if(nums[i-1]+d-1<nums[i]){\n              ans+=d;// if nothing is common in interval\n          }else {\n              ans=ans+nums[i]-nums[i-1];// if common in interval just subtract\n          } \n        }\n        return ans;\n    }\n}\n```\nnow 1 line solution \n```\nclass Solution {\n    public int findPoisonedDuration(int[] nums, int d) {\n        int ans=d;\n        for(int i=1;i<nums.length;i++){ ans+=Math.min(d,num[i]-num[i-1];}\n        return ans;\n    }\n}\n```
['Java']