11.13
This commit is contained in:
parent
57188457a6
commit
6ecbb3232a
1 changed files with 13 additions and 0 deletions
13
src/Test344.kt
Normal file
13
src/Test344.kt
Normal file
|
@ -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--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue