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 b7c0147 commit 83a24e1Copy full SHA for 83a24e1
9.go
@@ -6,14 +6,14 @@ import (
6
)
7
8
func isPalindrome(x int) bool {
9
- // Convert the int to a string
10
x_str := strconv.Itoa(x)
11
length_of_x := len(x_str)
12
13
halfway := length_of_x / 2
+ end_index := length_of_x - 1
14
15
- for i := 0; i < halfway; i++ {
16
- if x_str[i] != x_str[length_of_x-i-1] {
+ for index := 0; index < halfway; index++ {
+ if x_str[index] != x_str[end_index-index] {
17
return false
18
}
19
0 commit comments