上一页 1 2 3 4 5 6 ··· 16 下一页

Leetcode:Sqrt(x)

摘要: Implementint sqrt(int x).Compute and return the square root ofx.分析:二分查找。首先确定二分查找终止的条件和返回条件,其次对于与数字有关的题要注意int的表示范围防止溢出(比如该题两个int相乘可能会超过int的范围,故采用x/mid与... 阅读全文
posted @ 2015-01-14 21:44 Ryan-Xing 阅读(197) 评论(0) 推荐(0) 编辑

Leetcode:Combination Sum II

摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2015-01-14 14:22 Ryan-Xing 阅读(104) 评论(0) 推荐(0) 编辑

Leetcode:Unique Paths II

摘要: Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文
posted @ 2015-01-13 22:24 Ryan-Xing 阅读(177) 评论(0) 推荐(0) 编辑

Leetcode:Unique Paths

摘要: A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文
posted @ 2015-01-13 22:04 Ryan-Xing 阅读(148) 评论(0) 推荐(0) 编辑

Leetcode:Permutations II

摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2015-01-13 14:49 Ryan-Xing 阅读(146) 评论(0) 推荐(0) 编辑

Leetcode:Permutations

摘要: Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2015-01-12 16:19 Ryan-Xing 阅读(186) 评论(0) 推荐(0) 编辑

Leetcode:Palindrome Partitioning II

摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文
posted @ 2015-01-08 11:59 Ryan-Xing 阅读(126) 评论(0) 推荐(0) 编辑

Leetcode:Search a 2D Matrix

摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2015-01-06 16:43 Ryan-Xing 阅读(103) 评论(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 @ 2015-01-06 16:31 Ryan-Xing 阅读(95) 评论(0) 推荐(0) 编辑

Leetcode:First Missing Positive

摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2015-01-06 15:37 Ryan-Xing 阅读(139) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 16 下一页