Skip to content

Instantly share code, notes, and snippets.

@abdulrahmanAlotaibi
Created December 15, 2022 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdulrahmanAlotaibi/b1838f3cb6626b53d799b88bc10f459e to your computer and use it in GitHub Desktop.
Save abdulrahmanAlotaibi/b1838f3cb6626b53d799b88bc10f459e to your computer and use it in GitHub Desktop.
isPalindromic Algorithim
package main
import "fmt"
func main(){
fmt.Println("Is the the string the same if we reverse it ?")
fmt.Println(isPalindromic("AHA"))
fmt.Println(isPalindromic("Go"))
}
func isPalindromic(s string)bool{
for i,j := 0, len(s) - 1 ; i < len(s) ; i,j = i+1, j-1 {
if s[i] != s[j]{
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment