mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-24 02:14:00 +08:00
Update solution 0541
This commit is contained in:
@ -53,6 +53,18 @@ func reverseStr(s string, k int) string {
|
||||
return s
|
||||
}
|
||||
|
||||
func revers(s string) string {
|
||||
bytes := []byte(s)
|
||||
i, j := 0, len(bytes)-1
|
||||
for i < j {
|
||||
bytes[i], bytes[j] = bytes[j], bytes[i]
|
||||
i++
|
||||
j--
|
||||
}
|
||||
return string(bytes)
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user