随笔分类 -  LeetCode

摘要:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribeto see which comp... 阅读全文
posted @ 2015-12-07 19:59 zengzy 阅读(182) 评论(0) 推荐(0)
摘要:32. Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses su... 阅读全文
posted @ 2015-12-07 19:31 zengzy 阅读(142) 评论(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 @ 2015-12-07 18:07 zengzy 阅读(148) 评论(0) 推荐(0)
摘要:一.SubsetsGiven a set of distinct integers,nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set... 阅读全文
posted @ 2015-12-06 22:22 zengzy 阅读(191) 评论(0) 推荐(0)
摘要:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文
posted @ 2015-12-06 22:19 zengzy 阅读(188) 评论(0) 推荐(0)
摘要:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon... 阅读全文
posted @ 2015-12-06 22:17 zengzy 阅读(264) 评论(0) 推荐(0)
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.2... 阅读全文
posted @ 2015-12-06 22:04 zengzy 阅读(253) 评论(0) 推荐(0)
摘要:一.Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.罗马数字是阿拉伯数字传入之前使用的一种数码。罗马数字... 阅读全文
posted @ 2015-12-06 19:53 zengzy 阅读(200) 评论(0) 推荐(0)
摘要:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C prog... 阅读全文
posted @ 2015-12-06 19:02 zengzy 阅读(222) 评论(0) 推荐(0)
摘要:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The... 阅读全文
posted @ 2015-12-06 15:53 zengzy 阅读(168) 评论(0) 推荐(0)
摘要:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the e... 阅读全文
posted @ 2015-12-04 13:37 zengzy 阅读(429) 评论(0) 推荐(1)
摘要:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2015-12-04 12:59 zengzy 阅读(148) 评论(0) 推荐(0)
摘要:Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat... 阅读全文
posted @ 2015-12-04 12:37 zengzy 阅读(205) 评论(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 @ 2015-12-03 16:46 zengzy 阅读(210) 评论(0) 推荐(0)
摘要:There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
posted @ 2015-12-02 17:10 zengzy 阅读(169) 评论(0) 推荐(0)
摘要:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definiti... 阅读全文
posted @ 2015-12-01 00:27 zengzy 阅读(170) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definitio... 阅读全文
posted @ 2015-12-01 00:17 zengzy 阅读(150) 评论(0) 推荐(0)
摘要:Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i... 阅读全文
posted @ 2015-11-30 10:47 zengzy 阅读(209) 评论(0) 推荐(0)
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2015-11-30 00:34 zengzy 阅读(153) 评论(0) 推荐(0)
摘要:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2015-11-30 00:01 zengzy 阅读(178) 评论(0) 推荐(0)

levels of contents