摘要: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Example 2: 题解: 阅读全文
posted @ 2018-03-25 23:42 Vincent丶丶 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文
posted @ 2018-03-25 23:17 Vincent丶丶 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
posted @ 2018-03-25 22:07 Vincent丶丶 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题解: 归并思想。 Solution 1 Solution 2 利用最小堆,c++的优先队列prior 阅读全文
posted @ 2018-03-25 21:56 Vincent丶丶 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2018-03-25 20:41 Vincent丶丶 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文
posted @ 2018-03-25 20:34 Vincent丶丶 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文
posted @ 2018-03-25 20:06 Vincent丶丶 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings. 题解: 简单的暴力遍历解决 阅读全文
posted @ 2018-03-25 17:04 Vincent丶丶 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Given an integer, convert it to a roman nu 阅读全文
posted @ 2018-03-25 16:51 Vincent丶丶 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Given a roman numeral, convert it to an in 阅读全文
posted @ 2018-03-25 16:23 Vincent丶丶 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Implement regular expression matching with support for '.' and '*'. 题解: 这种题是最无语的。。。我试着用遍历做,当 s 为空,p 不为空时的判定怎么也总结不出规律了。还是得用递归做 注意 ’*‘ 之前必须有字符供其匹配。s = " 阅读全文
posted @ 2018-03-25 15:56 Vincent丶丶 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi 阅读全文
posted @ 2018-03-25 14:04 Vincent丶丶 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
posted @ 2018-03-25 13:40 Vincent丶丶 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environment which cou 阅读全文
posted @ 2018-03-25 11:30 Vincent丶丶 阅读(125) 评论(0) 推荐(0) 编辑
摘要: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font 阅读全文
posted @ 2018-03-25 10:59 Vincent丶丶 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Manacher's Algorithm针对的是最长回文子串问题。对于此问题,最直接的方法是遍历每一个元素,遍历过程中以每一个字符为中心向两边扩展以寻找此字符为中心的最长回文子串。复杂度O(n2)。Manacher算法将时间复杂度降至O(n),关键点在于将奇偶字串统一成奇数字串。 方法是在每一个字符 阅读全文
posted @ 2018-03-25 09:20 Vincent丶丶 阅读(217) 评论(0) 推荐(0) 编辑