
Check Palindrome: Brute force, better and better approaches with advice and techniques | By allows you to learn now | April 2025
Leetcode # 125: Palindrome (easy)

Hello everyone, I start the series of questions Leetcode Top75 as the most important competence these days that are posed in many companies. I start with questions related to channels. I hope this helps you suck your technical interviews, improves your analytical and programming skills.
I have facilitated the reference to interview questions according to the subjects (Core Java, Microservices, Spring Boot, Design Matchs, AWS, Leetcode, etc.) and the lists prepared below.
https://medium.com/@mpavani667/list/reading-list
https://leetcode.com/problems/valid-palindrome/description/
Issue:
A sentence is a palindrome If, after having converted all the upper letters into tiny letters and removed all non -alphanumeric characters, he reads the same thing in front and back. Alphanumeric characters include letters and numbers.
Given a chain s
back true
If it is a palindromeOr false
Otherwise.
Example 1:
Input: s = "A man, a plan, a canal: Panama"
Output: true
Explanation: "amanaplanacanalpanama" is a palindrome.
Example 2:
Input: s = "race a car"
Output: false
Explanation: "raceacar" is not a palindrome.
Example 3:
Input: s = " "
Output: true
Explanation: s is an empty string "" after removing non-alphanumeric characters.
Since an empty string reads the same forward and backward, it is a palindrome.
Constraints:
1 <= s.length <= 2 * 105
s
only consist of printable ascii characters.
Solution:
Brute force
Intuition:
- Reverse the chain and compare it with the original.
- If the two are the same, it is a palindrome.
public class PalindromeCheck {
public static boolean isPalindrome(String s) {
String reversed = new…