Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

HackerEarth Palindromic String problem solution

YASH PAL, 31 July 2024
In this HackerEarth Palindromic String problem solution, you have been given a String S. You need to find and print whether this string is a palindrome or not. If yes, print “YES” (without quotes), else print “NO” (without quotes).
hackerEarth Palindromic String problem solution

HackerEarth Palindromic String problem solution.

import java.io.BufferedReader;
import java.io.InputStreamReader;

class CheckPalindromicString{
public static void main(String args[] ) throws Exception {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
System.out.println(palindromeCheck(line.toCharArray())?"YES":"NO");
}
public static boolean palindromeCheck(char [] arr)
{
int startIndex=0;
int lastIndex=arr.length-1;
while(lastIndex>startIndex)
{
if(arr[startIndex]!=arr[lastIndex])
return false;
++startIndex;
--lastIndex;
}
return true;
}
}
coding problems

Post navigation

Previous post
Next post
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
  • Hackerrank Day 14 scope 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes