Skip to content

Commit 8487a85

Browse files
authored
Update README_EN.md
1 parent 3142012 commit 8487a85

File tree

1 file changed

+14
-0
lines changed
  • solution/1800-1899/1823.Find the Winner of the Circular Game

1 file changed

+14
-0
lines changed

solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ function findTheWinner(n: number, k: number): number {
148148
}
149149
```
150150

151+
#### Rust
152+
153+
```rust
154+
impl Solution {
155+
pub fn find_the_winner(n: i32, k: i32) -> i32 {
156+
if n == 1 {
157+
return 1;
158+
}
159+
let mut ans = (k + Solution::find_the_winner(n - 1, k)) % n;
160+
return if ans == 0 { n } else { ans };
161+
}
162+
}
163+
```
164+
151165
#### JavaScript
152166

153167
```js

0 commit comments

Comments
 (0)