Skip to content

Commit b077a39

Browse files
authored
Update README_EN.md
1 parent c6e2a98 commit b077a39

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

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

158+
#### Rust
159+
160+
```rust
161+
impl Solution {
162+
pub fn max_bottles_drunk(mut num_bottles: i32, mut num_exchange: i32) -> i32 {
163+
let mut ans = num_bottles;
164+
165+
while num_bottles >= num_exchange {
166+
num_bottles -= num_exchange;
167+
num_exchange += 1;
168+
ans += 1;
169+
num_bottles += 1;
170+
}
171+
172+
ans
173+
}
174+
}
175+
```
176+
158177
<!-- tabs:end -->
159178

160179
<!-- solution:end -->

0 commit comments

Comments
 (0)