随笔分类 -  practice

1 2 下一页

[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) 编辑

[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]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]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) 编辑

[leetcode]Binary Tree Maximum Path Sum
摘要:Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be... 阅读全文

posted @ 2014-08-11 19:43 喵星人与汪星人 阅读(212) 评论(0) 推荐(0) 编辑

[leetcode]Maximum Subarray
摘要:Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−... 阅读全文

posted @ 2014-08-10 19:47 喵星人与汪星人 阅读(202) 评论(0) 推荐(0) 编辑

[leetcode]First Missing Positive
摘要:First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Yo... 阅读全文

posted @ 2014-08-09 22:32 喵星人与汪星人 阅读(167) 评论(0) 推荐(0) 编辑

[leetcode]Sudoku Solver
摘要:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that the... 阅读全文

posted @ 2014-08-09 21:17 喵星人与汪星人 阅读(213) 评论(0) 推荐(0) 编辑

[leetcode]Valid Sudoku
摘要:Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are ... 阅读全文

posted @ 2014-08-09 20:38 喵星人与汪星人 阅读(279) 评论(0) 推荐(0) 编辑

[leetcode]Jump Game
摘要:Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo... 阅读全文

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

[leetcode]Sqrt(x)
摘要:Sqrt(x)Implementint sqrt(int x).Compute and return the square root ofx.【注意】:1.本题int类型可能会溢出,因此不能用乘法运算,应尽量用除法。2. 绝大多数数字都不是可开方的,该如何得到比较近的结果呢?算法思路:思路1:顺序遍... 阅读全文

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

[leetcode]Palindrome Partitioning II
摘要:Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p... 阅读全文

posted @ 2014-08-07 19:39 喵星人与汪星人 阅读(244) 评论(0) 推荐(0) 编辑

[leetcode]Word Break
摘要:Word BreakGiven a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.... 阅读全文

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

[leetcode]Decode Ways
摘要:Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me... 阅读全文

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

[leetcode]Distinct Subsequences
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文

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

[leetcode]Edit distance
摘要:Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文

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

1 2 下一页