VOOZH about

URL: https://www.geeksforgeeks.org/interview-experiences/tcs-coding-practice-question-palindrome-string/

⇱ TCS Coding Practice Question | Palindrome String - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

TCS Coding Practice Question | Palindrome String

Last Updated : 11 Jul, 2025
Given a string, the task is to check if this String is Palindrome or not using Command Line Arguments. Examples:
Input: str = "Geeks"
Output: No

Input: str = "GFG"
Output: Yes
Approach:
  • Since the string is entered as Command line Argument, there is no need for a dedicated input line
  • Extract the input string from the command line argument
  • Traverse through this String character by character using loop, till half the length of the sting
  • Check if the characters from one end match with the characters from the other end
  • If any character do not matches, the String is not Palindrome
  • If all character matches, the String is a Palindrome
Program: Output:
Comment