Skip to content
Onsite

Valid Palindrome II

EasyP2Coding

Return true if s is a palindrome or can become one by deleting at most one character, and false otherwise.

Example 1

Input
s = "aba"
Output
true

Example 2

Input
s = "abca"
Output
true

Example 3

Input
s = "abc"
Output
false

Constraints

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

Hints

Run checks the 3 visible tests, Submit all 13.