上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 28 下一页
摘要: Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must no... 阅读全文
posted @ 2015-05-18 22:29 TonyLuis 阅读(275) 评论(0) 推荐(0) 编辑
摘要: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,... 阅读全文
posted @ 2015-05-18 21:29 TonyLuis 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD... 阅读全文
posted @ 2015-05-18 20:56 TonyLuis 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-05-17 16:26 TonyLuis 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr... 阅读全文
posted @ 2015-05-17 12:01 TonyLuis 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.解题思路:用两个boolean数组row col表示行列是否有零即可,JAVA实现如下: public void ... 阅读全文
posted @ 2015-05-17 10:18 TonyLuis 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
posted @ 2015-05-17 09:53 TonyLuis 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"解题思路:首先要了解linux目录的... 阅读全文
posted @ 2015-05-16 19:56 TonyLuis 阅读(148) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cli... 阅读全文
posted @ 2015-05-16 19:32 TonyLuis 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x).Compute and return the square root of x.解题思路一: public int mySqrt(int x) { return (int)Math.sqrt(x); }神奇般的Accept... 阅读全文
posted @ 2015-05-16 19:27 TonyLuis 阅读(101) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 28 下一页