[LeetCode] Minimum Depth of Binary Tree

摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2012-12-27 13:02 小刀初试 阅读(98) 评论(0) 推荐(0)

[LeetCode] Merge Sorted Array 解题思路

摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements fr... 阅读全文
posted @ 2012-12-27 12:46 小刀初试 阅读(103) 评论(0) 推荐(0)

[LeetCode] Merge k Sorted Lists 解题报告

摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.» Solve this problem[解题思路]merge sort。外面套一层循环即可。注意指针操... 阅读全文
posted @ 2012-12-27 12:24 小刀初试 阅读(104) 评论(0) 推荐(0)

[LeetCode] Median of Two Sorted Arrays 解题报告

摘要: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文
posted @ 2012-12-27 11:39 小刀初试 阅读(128) 评论(0) 推荐(0)

[LeetCode] Maximum Subarray 解题报告

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1... 阅读全文
posted @ 2012-12-26 11:04 小刀初试 阅读(160) 评论(0) 推荐(0)

[LeetCode] Maximum Depth of Binary Tree

摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2012-12-26 08:41 小刀初试 阅读(95) 评论(0) 推荐(0)

[LeetCode] Longest Substring Without Repeating Characters 解题报告

摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2012-12-25 10:03 小刀初试 阅读(130) 评论(0) 推荐(0)

[LeetCode] Longest Palindromic Substring 解题报告

摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes... 阅读全文
posted @ 2012-12-25 08:45 小刀初试 阅读(110) 评论(0) 推荐(0)

[LeetCode] Longest Common Prefix 解题报告

摘要: Write a function to find the longest common prefix string amongst an array of strings.» Solve this problem[解题报告]又一个实现题。遍历字符串数组,每次用当前prefix和下一个字符串匹配以生成... 阅读全文
posted @ 2012-12-25 05:49 小刀初试 阅读(132) 评论(0) 推荐(0)

[LeetCode] Letter Combinations of a Phone Number 解题报告

摘要: 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 @ 2012-12-25 03:48 小刀初试 阅读(136) 评论(0) 推荐(0)