Problem Statement
Which of the following strings is a palindrome?
Explanation
A palindrome reads the same forward and backward. 'level' satisfies this because reversing it gives the same word. Palindrome checking is a common interview problem requiring two-pointer or reverse-string logic.
Code Solution
SolutionRead Only
boolean isPalindrome(String s){
int i=0,j=s.length()-1;
while(i<j){
if(s.charAt(i)!=s.charAt(j)) return false;
i++; j--; }
return true; }
// Input: level -> truePractice Sets
This question appears in the following practice sets:
