Java

Server-less Java : Palindrome?

Java as cloud-deployed AWS Lambda Functions operating through the AWS API Gateway.


Simple, interactive Java examples collected over the last 10 months or so...

Problem

Check if an input string is a palindrome {is the same if reversed}

Solve

Step 1. The Method


Reverse the input string {as a StringBuilder}. Compare the reversed string to the original. If they're the same, that's a palindrome. This is an easy to write solution. Though given its nature, it's not the fastest implementation! A quicker way would be to compare characters at either end, moving towards the centre.

Implement