below is my code for Leetcode 9 Palindrome Number. It shows “String index out of range error” for line 8 when the testcase is 121. Can anyone tell me why this happened? Thanks! Answer In the while loop, j remains constant whereas your “s” is reducing 1 char each loop. Example: as you see, s.subString(0, 8) will return the above
Tag: palindrome
How do you check if a word has an anagram that is a palindrome?
How do you compare a palindromic word to one of the newly formed words of an anagram? And how do you grab one of the newly formed words for it to be compared to the input word? This is my code: It’s not yet done because the permutation and comparison won’t work. The output is displaying false, I need it