From 6ecbb3232af13e204441b7ce671b03dbff925768 Mon Sep 17 00:00:00 2001 From: Kagura Date: Thu, 14 Nov 2024 17:53:01 +0800 Subject: [PATCH] 11.13 --- src/Test344.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Test344.kt diff --git a/src/Test344.kt b/src/Test344.kt new file mode 100644 index 0000000..1b78174 --- /dev/null +++ b/src/Test344.kt @@ -0,0 +1,13 @@ +class Test344 { + class Solution { + fun reverseString(s: CharArray): Unit { + var l = 0 + var r = s.lastIndex + while (l < r){ + s[l] = s[r].also { s[r] = s[l] } + l++ + r-- + } + } + } +} \ No newline at end of file