FunctionRacerProblemsRace

Valid Palindrome II

MediumTwo pointersPython, JavaScript, TypeScript, Java, C++

Return True if s reads the same forwards and backwards after deleting at most one character (deleting none is allowed), otherwise False.

Example 1

s "abca"
returns true

Delete c (or b) to get a palindrome.

Example 2

s "abc"
returns false

One deletion is not enough.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Two pointers problems