Back to course home
0% completed
Vote For New Content
My solution
Akshay Hedau
Jul 31, 2023
class Solution { public boolean isPalindrome(String s) { // TODO: Write your code here s = s.toLowerCase(); int st = 0; s = s.toLowerCase(); int ed = s.length() - 1; char[] curS = s.toCharArray(); while (st < ed) { char curSt = curS[st]; char curEd = curS[ed]; if (curSt > 'a' && curSt < 'z' && curEd > 'a' && curEd < 'z') { if (curSt != curEd) return false; st++; ed--; } else if (curSt > 'a' && curSt < 'z') { ed--; } else if (curEd > 'a' && curEd < 'z') { st++; } else { st++; ed--; } } return true; } }
0
0
Comments
Comments
On this page