Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Valid Palindrome II

Easy
two-pointersstringgreedy

Given a string s, return true if it can become a palindrome after deleting at most one character.

Input: one line, the string s. Output: true or false.

Example 1
Input:
aba
Output:
true
Example 2
Input:
abca
Output:
true

Delete 'c' (or 'b').

Example 3
Input:
abc
Output:
false

Constraints

  • 1 ≤ s.length ≤ 10^5
  • Lowercase English letters only.
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.