随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 下一页

LeetCode:Sqrt(x) 解题报告
摘要:Sqrt(x)Implementint sqrt(int x).Compute and return the square root ofx.SOLUTION 1:参见:二分法总结,以及模板:http://t.cn/RZGkPQc 1 public class Solution { 2 pu... 阅读全文

posted @ 2015-01-02 22:59 Yu's Garden 阅读(2186) 评论(0) 推荐(0) 编辑

LeetCode: Search in Rotated Sorted Array II 解题报告
摘要:Search in Rotated Sorted Array IIFollow up for "LeetCode: Search in Rotated Sorted Array 解题报告":What ifduplicatesare allowed?Would this affect the run-... 阅读全文

posted @ 2015-01-01 20:34 Yu's Garden 阅读(728) 评论(0) 推荐(0) 编辑

LeetCode: Search in Rotated Sorted Array 解题报告
摘要:Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).... 阅读全文

posted @ 2015-01-01 20:23 Yu's Garden 阅读(924) 评论(0) 推荐(0) 编辑

LeetCode: Binary Search Tree Iterator 解题报告
摘要:Binary Search Tree IteratorImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callin... 阅读全文

posted @ 2015-01-01 16:42 Yu's Garden 阅读(5711) 评论(0) 推荐(0) 编辑

LeetCode: Search Insert Position 解题报告
摘要:Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ... 阅读全文

posted @ 2015-01-01 00:17 Yu's Garden 阅读(575) 评论(0) 推荐(0) 编辑

LeetCode: Search a 2D Matrix 解题报告
摘要:Search a 2D MatrixWrite an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row... 阅读全文

posted @ 2014-12-31 23:50 Yu's Garden 阅读(994) 评论(2) 推荐(1) 编辑

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-12-31 18:21 Yu's Garden 阅读(5074) 评论(0) 推荐(1) 编辑

LeetCode: Pascal's Triangle II 解题报告
摘要:Pascal's Triangle II Total Accepted: 19384 Total Submissions: 63446 My Submissions Question SolutionGiven an index k, return the kth row of the Pascal... 阅读全文

posted @ 2014-12-30 23:48 Yu's Garden 阅读(505) 评论(0) 推荐(0) 编辑

LeetCode: Pascal's Triangle 解题报告
摘要:Pascal'sTriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3... 阅读全文

posted @ 2014-12-30 23:44 Yu's Garden 阅读(623) 评论(0) 推荐(0) 编辑

LeetCode: Valid Palindrome 解题报告
摘要:Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla... 阅读全文

posted @ 2014-12-30 20:16 Yu's Garden 阅读(616) 评论(0) 推荐(0) 编辑

LeetCode: Palindrome 回文相关题目
摘要:LeetCode: Palindrome 回文相关题目汇总LeetCode: Palindrome Partitioning 解题报告LeetCode: Palindrome Partitioning II 解题报告Leetcode:【DP】Longest Palindromic Substring... 阅读全文

posted @ 2014-12-30 19:44 Yu's Garden 阅读(609) 评论(0) 推荐(0) 编辑

LeetCode: Largest Rectangle in Histogram 解题报告
摘要:Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area o 阅读全文

posted @ 2014-12-29 16:38 Yu's Garden 阅读(2579) 评论(2) 推荐(1) 编辑

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-12-28 18:48 Yu's Garden 阅读(2476) 评论(1) 推荐(0) 编辑

Leetcode:Interleaving String 解题报告
摘要:Interleaving StringGiven s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = ... 阅读全文

posted @ 2014-12-27 21:23 Yu's Garden 阅读(742) 评论(0) 推荐(0) 编辑

Leetcode: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-12-27 20:38 Yu's Garden 阅读(5079) 评论(0) 推荐(1) 编辑

Leetcode:【DP】Longest Palindromic Substring 解题报告
摘要:Longest Palindromic Substring-- HARD 级别Question SolutionGiven a string S, find the longest palindromic substring in S. You may assume that the maximum... 阅读全文

posted @ 2014-12-27 19:36 Yu's Garden 阅读(3082) 评论(0) 推荐(1) 编辑

Leetcode:Longest Substring Without Repeating Characters 解题报告
摘要:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ... 阅读全文

posted @ 2014-12-27 18:41 Yu's Garden 阅读(588) 评论(0) 推荐(0) 编辑

Leetcode: Remove Duplicates from Sorted List II 解题报告
摘要:Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or... 阅读全文

posted @ 2014-12-27 10:05 Yu's Garden 阅读(593) 评论(0) 推荐(0) 编辑

Leetcode:Flatten Binary Tree to Linked List 解题报告
摘要:Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ... 阅读全文

posted @ 2014-12-26 13:36 Yu's Garden 阅读(953) 评论(0) 推荐(1) 编辑

LeetCode: Convert Sorted Array to Binary Search Tree 解题报告
摘要:Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.SOLUTION 1:... 阅读全文

posted @ 2014-12-23 12:30 Yu's Garden 阅读(364) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 下一页

导航