Valid Palindrome
We'll cover the following
Statement
Write a function that takes a string, s
, as an input and determines whether or not it is a palindrome.
Note: A palindrome is a word, phrase, or sequence of characters that reads the same backward as forward.
Constraints:
-
s.length
- The string
s
will not contain any white space and will only consist of ASCII characters(digits and letters).
Examples
Understand the problem
Let’s take a moment to make sure you've correctly understood the problem. The quiz below helps you check if you're solving the correct problem:
Valid Palindrome
1
“abab” is a palindrome.
A)
True
B)
False
Question 1 of 40 attempted
Figure it out!
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding on how to solve this problem.
Try it yourself
Implement your solution in the following coding playground. The supporting code template provided in TwoPointers.java
is meant to assist in developing your solution to the problem.
Java
usercode > Main.java
import java.util.*;public class Main{public static boolean isPalindrome(String s) {// Replace this placeholder return statement with your codereturn false;}}
Click "Run" to evaluate your code.
Valid Palindrome