leetcode680】的更多相关文章

Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True  Example 2: Input: "abca" Output: True Explanation: You could delete the character 'c'. …
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Example 2: Input: "abca" Output: True Explanation: You could delete the character 'c'. c…
class Solution { public: bool validPalindrome(string s) { int len = s.length(); ) return true; , len - , ); } private: bool judge(string s, int l, int r, int cnt) { ) { if (s[l] != s[r]) { ) return false; , r, cnt - ) || judge(s, l, r - , cnt - ); }…
给定一个非空字符串 s,最多删除一个字符.判断是否能成为回文字符串. 示例 1: 输入: "aba" 输出: True 示例 2: 输入: "abca" 输出: True 解释: 你可以删除c字符. 注意: 字符串只包含从 a-z 的小写字母.字符串的最大长度是50000. class Solution { public: bool validPalindrome(string s) { int len = s.size(); if(len == 0) return…