From edc79d0eda56871fbda3c6dd5952a535e54b7d4f Mon Sep 17 00:00:00 2001 From: "go-interview-practice-bot[bot]" <230190823+go-interview-practice-bot[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:02:15 +0000 Subject: [PATCH 1/2] Add solution for Challenge 17 --- .../JoQCorreia/solution-template.go | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 challenge-17/submissions/JoQCorreia/solution-template.go diff --git a/challenge-17/submissions/JoQCorreia/solution-template.go b/challenge-17/submissions/JoQCorreia/solution-template.go new file mode 100644 index 000000000..2e500b4eb --- /dev/null +++ b/challenge-17/submissions/JoQCorreia/solution-template.go @@ -0,0 +1,55 @@ +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + // Get input from the user + var input string + fmt.Print("Enter a string to check if it's a palindrome: ") + fmt.Scanln(&input) + + // Call the IsPalindrome function and print the result + result := IsPalindrome(input) + if result { + fmt.Println("The string is a palindrome.") + } else { + fmt.Println("The string is not a palindrome.") + } +} + +// IsPalindrome checks if a string is a palindrome. +// A palindrome reads the same backward as forward, ignoring case, spaces, and punctuation. +func IsPalindrome(s string) bool { + + //Removes all characters that are not letters or numbers and makes string lowercase + pal := strings.Map(func(c rune) rune { + if !unicode.IsLetter(c) && !unicode.IsNumber(c) { + return -1 + } + return c + }, strings.ToLower(s)) + + //If string has no characters, it returns true + if len(pal) == 0 { + return true + } + + //Full index of string + indx := len(pal) - 1 + + for i := 0; i <= (indx - i); i++ { + //Loop compares the letters on opposite sides of the string for matches + if pal[i] != pal[indx-i] { + return false + } + + continue + + } + + return true +} \ No newline at end of file From e843032c7da0e41554ccaee5f82a9f0de4748640 Mon Sep 17 00:00:00 2001 From: Joana Correia <75225698+JoQCorreia@users.noreply.github.com> Date: Thu, 16 Jul 2026 17:14:24 -0500 Subject: [PATCH 2/2] Update challenge-17/submissions/JoQCorreia/solution-template.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- challenge-17/submissions/JoQCorreia/solution-template.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/challenge-17/submissions/JoQCorreia/solution-template.go b/challenge-17/submissions/JoQCorreia/solution-template.go index 2e500b4eb..704aff3f0 100644 --- a/challenge-17/submissions/JoQCorreia/solution-template.go +++ b/challenge-17/submissions/JoQCorreia/solution-template.go @@ -38,12 +38,13 @@ func IsPalindrome(s string) bool { return true } - //Full index of string - indx := len(pal) - 1 + // Convert to runes to safely handle multi-byte Unicode characters + palRunes := []rune(pal) + indx := len(palRunes) - 1 for i := 0; i <= (indx - i); i++ { //Loop compares the letters on opposite sides of the string for matches - if pal[i] != pal[indx-i] { + if palRunes[i] != palRunes[indx-i] { return false }