We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83a24e1 commit dbb76a9Copy full SHA for dbb76a9
9.go
@@ -6,6 +6,10 @@ import (
6
)
7
8
func isPalindrome(x int) bool {
9
+ if x < 0 {
10
+ return false
11
+ }
12
+
13
x_str := strconv.Itoa(x)
14
length_of_x := len(x_str)
15
9_test.go
@@ -32,7 +32,9 @@ func TestIsPalindrome3(t *testing.T) {
32
}
33
34
func BenchmarkIsPalindrome(b *testing.B) {
35
- for i := 0; i < b.N; i++ {
+ midpoint := b.N / 2
36
37
+ for i := -midpoint; i < midpoint; i++ {
38
isPalindrome(b.N)
39
40
0 commit comments