Given a non-empty string s
, you may delete at most one character. Judge whether you can make it a palindrome.
Example 1:
1 |
Input: "aba" |
Example 2:
1 |
Input: "abca" |
Note:
- The string will only contain lowercase characters a-z. The maximum length of the string is 50000.
跟[125] 验证回文串 思路一样,只不过可以删字符,所以当字符不同的时候,左指针右移一格或者右指针左移一格,如果存在一种可能是回文的情况,就返回真。
my code in cpp
1 |
bool (string s) { |
近期评论