随笔分类 -  leetcode

1 2 3 4 5 ··· 7 下一页

[leecode]Implement strStr()
摘要:Implement strStr()Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.实现String... 阅读全文

posted @ 2014-09-14 23:13 喵星人与汪星人 阅读(189) 评论(0) 推荐(0) 编辑

[leecode]Scramble String
摘要:Scramble StringGiven a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible... 阅读全文

posted @ 2014-09-01 23:38 喵星人与汪星人 阅读(146) 评论(0) 推荐(0) 编辑

[leecode]Binary Tree Preorder Traversal
摘要:Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文

posted @ 2014-08-31 17:48 喵星人与汪星人 阅读(184) 评论(0) 推荐(0) 编辑

[leetcode]Binary Tree InorderTraversal
摘要:Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文

posted @ 2014-08-31 17:44 喵星人与汪星人 阅读(159) 评论(0) 推荐(0) 编辑

[leecode]Best Time to Buy and Sell Stock III
摘要:Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the... 阅读全文

posted @ 2014-08-26 17:20 喵星人与汪星人 阅读(191) 评论(0) 推荐(0) 编辑

[leecode]Clone Graph
摘要:Clone GraphClone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are l... 阅读全文

posted @ 2014-08-25 20:55 喵星人与汪星人 阅读(180) 评论(0) 推荐(0) 编辑

[leecode]Word Break II
摘要:Word Break IIGiven a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all... 阅读全文

posted @ 2014-08-24 22:49 喵星人与汪星人 阅读(283) 评论(0) 推荐(0) 编辑

[leetcode]Convert Sorted List to Binary Search Tree
摘要:Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.... 阅读全文

posted @ 2014-08-16 10:51 喵星人与汪星人 阅读(311) 评论(0) 推荐(0) 编辑

[leetcode]Minimum Path Sum
摘要:Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ... 阅读全文

posted @ 2014-08-16 00:58 喵星人与汪星人 阅读(198) 评论(0) 推荐(0) 编辑

[leetcode]Sum Root to Leaf Numbers
摘要:Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l... 阅读全文

posted @ 2014-08-16 00:45 喵星人与汪星人 阅读(204) 评论(0) 推荐(0) 编辑

[leetcode]Unique Binary Search Trees
摘要:Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a to... 阅读全文

posted @ 2014-08-16 00:38 喵星人与汪星人 阅读(159) 评论(0) 推荐(0) 编辑

[leetcode]Valid Number
摘要:Valid NumberValidate 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 ... 阅读全文

posted @ 2014-08-16 00:02 喵星人与汪星人 阅读(765) 评论(0) 推荐(0) 编辑

[leetcode]Unique Binary Search Trees II
摘要:Unique Binary Search Trees IIGivenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your pr... 阅读全文

posted @ 2014-08-15 22:55 喵星人与汪星人 阅读(281) 评论(0) 推荐(0) 编辑

[leetcode]Interleaving String
摘要:Interleaving StringGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文

posted @ 2014-08-15 21:25 喵星人与汪星人 阅读(393) 评论(0) 推荐(0) 编辑

[leetcode]Minimum Window Substring
摘要:Minimum Window SubstringGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Fo... 阅读全文

posted @ 2014-08-15 17:04 喵星人与汪星人 阅读(316) 评论(0) 推荐(0) 编辑

[leetcode]Spiral Matrix
摘要:Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[... 阅读全文

posted @ 2014-08-15 15:55 喵星人与汪星人 阅读(209) 评论(0) 推荐(0) 编辑

[leetcode]Spiral Matrix II
摘要:Spiral Matrix IIGiven an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the... 阅读全文

posted @ 2014-08-15 14:54 喵星人与汪星人 阅读(287) 评论(0) 推荐(0) 编辑

[leetcode]Rotate Image
摘要:Rotate ImageYou are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?CC上的原题,... 阅读全文

posted @ 2014-08-14 01:08 喵星人与汪星人 阅读(219) 评论(0) 推荐(0) 编辑

[leetcode]String to Integer (atoi)
摘要:String to Integer (atoi)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, plea... 阅读全文

posted @ 2014-08-14 00:23 喵星人与汪星人 阅读(230) 评论(0) 推荐(0) 编辑

[leetcode]Sort Colors
摘要:Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the or... 阅读全文

posted @ 2014-08-11 21:48 喵星人与汪星人 阅读(253) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 7 下一页