You are viewing a single comment's thread. Return to all comments →
public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String A = sc.next(); boolean noPalindrome = false; for (int i = 0; i < A.length() / 2; i++) { if (A.charAt(i) != A.charAt(A.length() - i - 1)) { System.out.println("No"); noPalindrome = true; break; } } if (!noPalindrome) System.out.println("Yes"); } }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Java String Reverse
You are viewing a single comment's thread. Return to all comments →