Skip to content

Commit 505f2ec

Browse files
authored
Update README.md
1 parent e758da3 commit 505f2ec

File tree

1 file changed

+20
-0
lines changed
  • solution/1700-1799/1701.Average Waiting Time

1 file changed

+20
-0
lines changed

solution/1700-1799/1701.Average Waiting Time/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,26 @@ function averageWaitingTime(customers: number[][]): number {
161161
}
162162
```
163163

164+
#### Rust
165+
166+
```rust
167+
impl Solution {
168+
pub fn average_waiting_time(customers: Vec<Vec<i32>>) -> f64 {
169+
let mut tot = 0.0;
170+
let mut t = 0;
171+
172+
for e in customers.iter() {
173+
let a = e[0];
174+
let b = e[1];
175+
t = t.max(a) + b;
176+
tot += (t - a) as f64;
177+
}
178+
179+
tot / customers.len() as f64
180+
}
181+
}
182+
```
183+
164184
#### JavaScript
165185

166186
```js

0 commit comments

Comments
 (0)