随笔分类 -  leedcode

上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-07-12 15:56 ~每天进步一点点~ 阅读(124) 评论(0) 推荐(0)
摘要:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.public class Solution { ... 阅读全文
posted @ 2015-07-12 15:46 ~每天进步一点点~ 阅读(100) 评论(0) 推荐(0)
摘要:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2015-07-12 15:31 ~每天进步一点点~ 阅读(130) 评论(0) 推荐(0)
摘要:public class Solution { public double myPow(double x, int n) { //利用二分法,通过递归加速计算 //注意:1.判断n是否为负 // 2.递归结束条件,n==1和n==0 //... 阅读全文
posted @ 2015-07-12 14:19 ~每天进步一点点~ 阅读(105) 评论(0) 推荐(0)
摘要:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.public class Solution { public Lis... 阅读全文
posted @ 2015-07-12 13:59 ~每天进步一点点~ 阅读(171) 评论(0) 推荐(0)
摘要:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?In order to fulfill... 阅读全文
posted @ 2015-07-11 12:53 ~每天进步一点点~ 阅读(143) 评论(0) 推荐(0)
摘要: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-07-11 11:54 ~每天进步一点点~ 阅读(219) 评论(0) 推荐(0)
摘要: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-07-11 11:03 ~每天进步一点点~ 阅读(140) 评论(0) 推荐(0)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-07-11 09:32 ~每天进步一点点~ 阅读(113) 评论(0) 推荐(0)
摘要:Straight forward idea. Just like the way we multiply numbers. Don't forget considering the carry and be careful. e.g. 123*456,what we usually do is: ... 阅读全文
posted @ 2015-07-10 22:18 ~每天进步一点点~ 阅读(155) 评论(0) 推荐(0)
摘要:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2015-07-10 18:20 ~每天进步一点点~ 阅读(207) 评论(0) 推荐(0)
摘要: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-07-10 17:17 ~每天进步一点点~ 阅读(180) 评论(0) 推荐(0)
摘要: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-07-10 15:59 ~每天进步一点点~ 阅读(166) 评论(0) 推荐(0)
摘要:public class Quanpailie { /** * 全排列的思想,第一位和后面的每一位进行交换,然后递归下一位 * combinate(int a[],int start,int end) * 参数的意思是从第start位开始到end位进行全排列 *... 阅读全文
posted @ 2015-07-10 15:33 ~每天进步一点点~ 阅读(194) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2015-07-10 15:27 ~每天进步一点点~ 阅读(201) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2015-07-10 14:15 ~每天进步一点点~ 阅读(124) 评论(0) 推荐(0)
摘要:Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文
posted @ 2015-07-09 22:52 ~每天进步一点点~ 阅读(121) 评论(0) 推荐(0)
摘要: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-07-09 18:25 ~每天进步一点点~ 阅读(122) 评论(0) 推荐(0)
摘要:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
posted @ 2015-07-09 18:09 ~每天进步一点点~ 阅读(132) 评论(0) 推荐(0)
摘要:Suppose 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).You are given a target value t... 阅读全文
posted @ 2015-07-09 17:46 ~每天进步一点点~ 阅读(100) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 下一页