2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
10
Task/Palindrome-detection/Go/palindrome-detection-2.go
Normal file
10
Task/Palindrome-detection/Go/palindrome-detection-2.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
func isPalindrome(s string) bool {
|
||||
runes := []rune(s)
|
||||
numRunes := len(runes) - 1
|
||||
for i := 0; i < len(runes)/2; i++ {
|
||||
if runes[i] != runes[numRunes-i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
10
Task/Palindrome-detection/Go/palindrome-detection-3.go
Normal file
10
Task/Palindrome-detection/Go/palindrome-detection-3.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
func isPalindrome(s string) bool {
|
||||
runes := []rune(s)
|
||||
for len(runes) > 1 {
|
||||
if runes[0] != runes[len(runes)-1] {
|
||||
return false
|
||||
}
|
||||
runes = runes[1 : len(runes)-1]
|
||||
}
|
||||
return true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue