From 3b83c30a6287add67f32b92d45a4ffb1e36c0ba1 Mon Sep 17 00:00:00 2001 From: yassine naanani <27584700+K11E3R@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:53:19 +0200 Subject: [PATCH 1/2] Rust Solution Added to README_EN --- .../README_EN.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md b/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md index ae70a45fec097..5db47b9aecabf 100644 --- a/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md +++ b/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md @@ -165,6 +165,23 @@ var findTheWinner = function (n, k) { }; ``` +#### Rust + +```rust +impl Solution { + pub fn find_the_winner(n: i32, k: i32) -> i32 { + if n == 1 { + return 1; + } + let mut ans = (k + Solution::find_the_winner(n - 1, k)) % n; + return if ans == 0 { n } else { ans }; + } +} +``` + + + + From 0ac0d0030c3d6f989f699790bb8cb75b69f6977e Mon Sep 17 00:00:00 2001 From: K11E3R Date: Mon, 8 Jul 2024 10:18:26 +0000 Subject: [PATCH 2/2] style: format code and docs with prettier --- .../1823.Find the Winner of the Circular Game/README_EN.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md b/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md index 5db47b9aecabf..fa56b8fe1bcf3 100644 --- a/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md +++ b/solution/1800-1899/1823.Find the Winner of the Circular Game/README_EN.md @@ -179,9 +179,6 @@ impl Solution { } ``` - - -