Skip to content

Commit ac12951

Browse files
authored
Rust Commit fix
1 parent ca2b065 commit ac12951

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

solution/3100-3199/3100.Water Bottles II/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ function maxBottlesDrunk(numBottles: number, numExchange: number): number {
155155
}
156156
```
157157

158-
#### TypeScript
158+
#### Rust
159159

160-
```rs
160+
```rust
161161
impl Solution {
162162
pub fn max_bottles_drunk(mut num_bottles: i32, mut num_exchange: i32) -> i32 {
163163
let mut ans = num_bottles;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
impl Solution {
2+
pub fn max_bottles_drunk(mut num_bottles: i32, mut num_exchange: i32) -> i32 {
3+
let mut ans = num_bottles;
4+
5+
while num_bottles >= num_exchange {
6+
num_bottles -= num_exchange;
7+
num_exchange += 1;
8+
ans += 1;
9+
num_bottles += 1;
10+
}
11+
12+
ans
13+
}
14+
}

0 commit comments

Comments
 (0)