上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页

[LeetCode] Subsets II 解题报告

摘要: Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order... 阅读全文
posted @ 2013-01-07 08:14 小刀初试 阅读(169) 评论(0) 推荐(0)

[LeetCode] Subsets 解题报告

摘要: Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not c... 阅读全文
posted @ 2013-01-07 08:03 小刀初试 阅读(199) 评论(0) 推荐(0)

[LeetCode] String to Integer (atoi) 解题报告

摘要: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a... 阅读全文
posted @ 2013-01-07 06:39 小刀初试 阅读(130) 评论(0) 推荐(0)

[LeetCode] Sqrt(x) 解题报告

摘要: Implement int sqrt(int x).Compute and return the square root of x.» Solve this problem[解题思路]二分法。但是这题有意思的是,二分过程中终止条件的确认。因为整数的乘法有可能导致溢出,而这种溢出的检测跟整数加法直接判... 阅读全文
posted @ 2013-01-07 05:29 小刀初试 阅读(451) 评论(0) 推荐(0)

[LeetCode] Spiral Matrix 解题报告

摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, ... 阅读全文
posted @ 2013-01-06 08:32 小刀初试 阅读(190) 评论(0) 推荐(0)

[LeetCode] Sort Colors 解题报告

摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ... 阅读全文
posted @ 2013-01-06 07:37 小刀初试 阅读(162) 评论(0) 推荐(0)

[LeetCode] Simplify Path 解题报告

摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did y... 阅读全文
posted @ 2013-01-06 06:57 小刀初试 阅读(164) 评论(0) 推荐(0)

[LeetCode] Set Matrix Zeroes 解题报告

摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solu... 阅读全文
posted @ 2013-01-06 06:22 小刀初试 阅读(179) 评论(0) 推荐(0)

[LeetCode] Search Insert Position 解题报告

摘要: Given 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 it were inserted in or... 阅读全文
posted @ 2013-01-04 13:56 小刀初试 阅读(243) 评论(0) 推荐(0)

[LeetCode] Search in Rotated Sorted Array II 解题报告

摘要: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function ... 阅读全文
posted @ 2013-01-04 13:38 小刀初试 阅读(145) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页