摘要: Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The... 阅读全文
posted @ 2014-10-07 19:09 小菜刷题史 阅读(154) 评论(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 thinki... 阅读全文
posted @ 2014-10-07 16:23 小菜刷题史 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文
posted @ 2014-10-07 16:01 小菜刷题史 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文
posted @ 2014-10-07 15:38 小菜刷题史 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ask... 阅读全文
posted @ 2014-10-07 14:21 小菜刷题史 阅读(101) 评论(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 fo... 阅读全文
posted @ 2014-10-07 13:45 小菜刷题史 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2014-10-06 22:48 小菜刷题史 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2014-10-03 22:46 小菜刷题史 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 把三个二叉树遍历的题放在一起了。递归写法太简单,就不再实现了,每题实现了两种非递归算法。一种是利用栈,时间和空间复杂度都是O(n)。另一种是借助线索二叉树,也叫Morris遍历,充分利用树中节点的空指针域。先序:Binary Tree Preorder TraversalGiven a binary... 阅读全文
posted @ 2014-10-03 20:39 小菜刷题史 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-10-02 13:08 小菜刷题史 阅读(150) 评论(0) 推荐(0) 编辑