Back to course home
0% completed
Solution: Valid Palindrome II
Problem Statement
Given string s
, determine whether it's possible to make a given string palindrome by removing at most one character.
A palindrome is a word or phrase that reads the same backward as forward.
Examples
-
Example 1:
- Input:
"racecar"
- Expected Output:
true
- Justification: The string is already a palindrome, so no removals are needed.
- Input:
-
Example 2:
- Input:
"abeccdeba"
- Expected Output:
true
- Justification: Removing the character 'd' forms the palindrome "abccba".
- Input:
-
Example 3:
- Input:
"abcdef"
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!