deno.land / x / masx200_leetcode_test@10.6.5 / reverse-prefix-of-word / index.go

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package index
import "strings"import "github.com/webx-top/com"
func reversePrefix(word string, ch byte) string { index := strings.IndexByte(word, ch) if index < 0 { return word }
return com.Reverse(word[0:index+1]) + string(word[index+1:])}
masx200_leetcode_test

Version Info

Tagged at
a year ago