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 Examp... ...
分类:
其他好文 时间:
2017-09-20 00:55:56
阅读次数:
309
字符串的括号匹配是一个很常见的问题。用栈这种后进先出的结构是非常适合的。此外,字符串中的回文以及衍生的各种问题也是字符串处理中非常常见的。 今天再说一下这类相似的问题,如何用递归来转化成子结构来求解。 先放一条LeetCode例题: 680. Valid Palindrome II Given a ...
分类:
其他好文 时间:
2017-09-18 00:19:15
阅读次数:
247
题目是: Given a string s,partition s such that every substring of the partition is a palindrome Return tthe mininum cuts needed for a palindrome partitio ...
分类:
其他好文 时间:
2017-09-13 20:26:42
阅读次数:
120
Cheapest Palindrome Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10624 Accepted: 5090 Description Keeping track of all the cows can be a ...
分类:
其他好文 时间:
2017-09-13 15:09:37
阅读次数:
159
1297. Palindrome Time limit: 1.0 second Memory limit: 64 MB The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that ...
分类:
编程语言 时间:
2017-09-12 00:03:13
阅读次数:
274
检查回文字符串 如果给定的字符串是回文,返回true,反之,返回false。 如果一个字符串忽略标点符号、大小写和空格,正着读和反着读一模一样,那么这个字符串就是palindrome(回文)。 注意你需要去掉字符串多余的标点符号和空格,然后把字符串转化成小写来验证此字符串是否为回文。 函数参数的值可 ...
分类:
其他好文 时间:
2017-09-03 01:12:57
阅读次数:
245
LeetCode真是个好东西,本来闲了一下午不想看书,感觉太荒废时间了就来刷一道题。能力有限,先把easy的题目给刷完。 Determine whether an integer is a palindrome. Do this without extra space. 确定一个整数是否是回文。 做 ...
分类:
其他好文 时间:
2017-09-02 23:23:32
阅读次数:
218
Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID ...
分类:
其他好文 时间:
2017-08-27 00:15:35
阅读次数:
271
旋转链表函数 public ListNode reverse(ListNode head) { ListNode prev = null; while (head != null) { ListNode next = head.next; head.next = prev; prev = head; ...
分类:
其他好文 时间:
2017-08-26 21:23:39
阅读次数:
158
Given a string s, cut s into some substrings such that every substring is a palindrome. Return the minimum cuts needed for a palindrome partitioning o ...
分类:
其他好文 时间:
2017-08-26 12:46:40
阅读次数:
226