The only thing need to do is to compare the difference of the adjacent elements in the array with that of the duration time. If larger, then it will take duration time to recover; if smaller, it will take the difference.
http://startleetcode.blogspot.com/2017/01/495-teemo-attacking.html