PIXELBANKv8.2.1
Menu

Valid Palindrome II

Given a string s, return True if s can be a palindrome after deleting at most one character.

Example:

Input:
aba
Output:
True
Reasoning:
  • The input string s is "aba", which is already a palindrome since it reads the same backward as forward.
  • No character needs to be deleted to make it a palindrome.
  • The condition of deleting at most one character is satisfied, as no deletion is required.
  • The function returns True, indicating that the string can be a palindrome after deleting at most one character.

Constraints:

  • 1 <= len(s) <= 10^5
  • s consists of lowercase English letters
Editor

Test Results

0/0
Run code to see test results.