#3683
Easy Algorithms Earliest time to finish one task
Array
84.4% acceptance
Feb 25, 2026
46
2
You are given a 2D integer array tasks where tasks[i] = [si, ti].
Each [si, ti] in tasks represents a task with start time si that takes ti units of time to finish.
Return the earliest time at which at least one task is finished.
Solution
Rust
Time O(n)
Space O(1)
impl Solution {
pub fn earliest_time(tasks: Vec<Vec<i32>>) -> i32 {
tasks.iter().map(|t| t[0] + t[1]).min().unwrap()
}
}