First (unsuccessful) attempt at day 7.1.
This commit is contained in:
14
2018/internal/util/strings.go
Normal file
14
2018/internal/util/strings.go
Normal file
@ -0,0 +1,14 @@
|
||||
package util
|
||||
|
||||
func ReverseString(s string) string {
|
||||
runes := []rune(s)
|
||||
|
||||
i := 0
|
||||
j := len(runes) - 1
|
||||
for i < j {
|
||||
runes[i], runes[j] = runes[j], runes[i]
|
||||
i++
|
||||
j--
|
||||
}
|
||||
return string(runes)
|
||||
}
|
Reference in New Issue
Block a user