495.提莫攻击 删除注释

This commit is contained in:
游由 2021-11-10 10:09:02 +08:00
parent 85ce171215
commit 8a4ab3e507
1 changed files with 0 additions and 12 deletions

View File

@ -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!()
}
}