495.提莫攻击 删除注释
This commit is contained in:
parent
85ce171215
commit
8a4ab3e507
|
@ -41,19 +41,7 @@ impl Solution {
|
|||
/// * 👍 192
|
||||
/// * 👎 0
|
||||
pub fn find_poisoned_duration(time_series: Vec<i32>, duration: i32) -> i32 {
|
||||
// int ans = 0;
|
||||
// int expired = 0;
|
||||
// for (int i = 0; i < timeSeries.length; ++i) {
|
||||
// if (timeSeries[i] >= expired) {
|
||||
// ans += duration;
|
||||
// } else {
|
||||
// ans += timeSeries[i] + duration - expired;
|
||||
// }
|
||||
// expired = timeSeries[i] + duration;
|
||||
// }
|
||||
// return ans;
|
||||
time_series.into_iter().fold((0, 0), |(r, e), t| if t >= e { (r + duration, t + duration) } else { (r + t + duration - e, t + duration) }).0
|
||||
//unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue