From the course: Nail Your Java Interview

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Developing a palindrome checker

Solution: Developing a palindrome checker - Java Tutorial

From the course: Nail Your Java Interview

Start my 1-month free trial

Solution: Developing a palindrome checker

(upbeat music) - [Instructor] Let's explore some functions that implement a palindrome checker. Remember a palindrome is a word or phrase which reads the same backwards as it does forwards. In our main function, we have some tester strings and calls to our two different algorithms. Both functions return a Boolean that we print out to the console. Let's take a look at the traditional palindrome checker. This is a more traditional way of figuring out if a given input string is a palindrome and there are similar implementations for other languages. In this function, we start by normalizing the original input string. Then we build a reverse string by iterating through the normalized string and adding each character to the reverse string. At the end, we check if the reverse string equals the normalized string. If they're equal then the original string must be a palindrome. Instead of manually reversing the string…

Contents