Skip to content

Valid Palindrome II

EasyTwo Pointers
Decode it first. Clues, constraints, pattern and plan before any code.

Given a string s, return true if it can become a palindrome after deleting at most one character. A palindrome reads the same forwards and backwards.

s = "aba"    →  true    (already a palindrome)
s = "abca"   →  true    (delete "c" or "b")
s = "abc"    →  false

Constraints

  • 1 <= s.length <= 10^5
  • s consists of lowercase English letters.