680. Valid Palindrome II
Given a non-empty strings
, you may deleteat mostone character. Judge whether you can make it a palindrome.
Example 1:
Example 2:
Note:
The string will only contain lowercase characters a-z. The maximum length of the string is 50000.
Thoughts:
Try to compare the head and tail char, if not equal then try compare (head + 1, tail) and (head, tail- 1).
Last updated
Was this helpful?