Skip to content

Commit 1496a67

Browse files
committed
Improved per PR notes
Signed-off-by: Slava Lysunkin <[email protected]>
1 parent 3bf3e19 commit 1496a67

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

go/Two Pointers/is_palindrome_valid.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
func isAlnum(r rune) bool {
2-
return unicode.IsLetter(r) || unicode.IsDigit(r)
3-
}
4-
51
func isPalindromeValid(input string) bool {
62
s := []rune(input)
73

@@ -28,3 +24,7 @@ func isPalindromeValid(input string) bool {
2824

2925
return true
3026
}
27+
28+
func isAlnum(r rune) bool {
29+
return unicode.IsLetter(r) || unicode.IsDigit(r)
30+
}

go/Two Pointers/next_lexicographical_sequence.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
func reverse(s []rune, start int) {
2-
end := len(s) - 1
3-
for start < end {
4-
s[start], s[end] = s[end], s[start]
5-
start++
6-
end--
7-
}
8-
}
9-
101
func nextLexicographicalSequence(s string) string {
112
letters := []rune(s)
123
// Locate the pivot, which is the first character from the right that breaks
@@ -33,3 +24,12 @@ func nextLexicographicalSequence(s string) string {
3324
reverse(letters, pivot+1)
3425
return string(letters)
3526
}
27+
28+
func reverse(s []rune, start int) {
29+
end := len(s) - 1
30+
for start < end {
31+
s[start], s[end] = s[end], s[start]
32+
start++
33+
end--
34+
}
35+
}

go/Two Pointers/pair_sum_sorted.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ func pairSumSorted(nums []int, target int) []int {
1515
return []int{left, right}
1616
}
1717
}
18-
return []int{}
18+
return nil
1919
}

0 commit comments

Comments
 (0)