Valid Palindrome

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome*, or false otherwise*.
LeetCode Problem - 125
class Solution {
public boolean isPalindrome(String s) {
// Convert the string to lowercase and remove non-alphanumeric characters.
String newStr = s.toLowerCase().replaceAll("[^a-zA-Z0-9]", "");
// Get the index of the last character in the modified string.
int lastIdx = (newStr.length())-1;
// Loop through the characters of the modified string.
for(int i=0; i<newStr.length(); i++){
// Compare characters from start and end of the string.
if(newStr.charAt(i)!=newStr.charAt(lastIdx)){
// If characters don't match, the string is not a palindrome.
return false;
}
// Move to the next character from the end.
lastIdx--;
}
// If all characters match, the string is a palindrome.
return true;
}
}




