上一页 1 2 3 4 5 6 7 8 ··· 20 下一页
摘要: 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) 编辑
摘要: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 题解: Solution 1 暴 阅读全文
posted @ 2018-03-24 13:33 Vincent丶丶 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文
posted @ 2018-03-24 01:01 Vincent丶丶 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 节点定义如下 前序遍历: 若二叉树为空,则空操作返回,否则: 中序遍历: 若二叉树为空,则空操作返回,否则: 后序遍历: 若二叉树为空,则空操作返回,否则: 层序遍历: 其中后序遍历可以看作是和前序遍历是对称的,所以从根节点开始先遍历右子树,再遍历左子树,不过要把最后的遍历输出翻转过来。所以后序遍历 阅读全文
posted @ 2018-03-17 09:13 Vincent丶丶 阅读(421) 评论(0) 推荐(0) 编辑
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2018-03-16 21:15 Vincent丶丶 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 自定义排序需要单独写一个compare函数 例1 LeetCode 056. Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6] 阅读全文
posted @ 2018-03-15 22:04 Vincent丶丶 阅读(7001) 评论(0) 推荐(0) 编辑
摘要: 我们有时想把变量放进正则表达式中来匹配想要的结果。Python中使用 re.compile(r''+变量+''),其中正则表达式中的“变量”应为字符串形式。 得到结果 可以看到,Python是将正则表达式用字符串表示的,格式为 r'正则表达式 ' 正则表达式使用变量例子: 结果为 附正则表达式语法: 阅读全文
posted @ 2018-03-09 20:43 Vincent丶丶 阅读(14475) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 20 下一页