摘要:
Implementint sqrt(int x).Compute and return the square root ofx.class Solution {public:int sqrt(int x){ long long left=0,right=x/2+1; while(left... 阅读全文
posted @ 2015-02-09 14:25
Vae永Silence
阅读(140)
评论(0)
推荐(0)
摘要:
You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2015-02-09 14:24
Vae永Silence
阅读(116)
评论(0)
推荐(0)
摘要:
Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2015-02-09 14:23
Vae永Silence
阅读(156)
评论(0)
推荐(0)
摘要:
Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文
posted @ 2015-02-09 14:22
Vae永Silence
阅读(186)
评论(0)
推荐(0)
摘要:
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s... 阅读全文
posted @ 2015-02-09 14:21
Vae永Silence
阅读(128)
评论(0)
推荐(0)
摘要:
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-02-09 14:20
Vae永Silence
阅读(155)
评论(0)
推荐(0)
摘要:
Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh... 阅读全文
posted @ 2015-02-09 14:19
Vae永Silence
阅读(187)
评论(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="ADOBECODEBA... 阅读全文
posted @ 2015-02-09 14:18
Vae永Silence
阅读(170)
评论(0)
推荐(0)
摘要:
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文
posted @ 2015-02-09 14:17
Vae永Silence
阅读(153)
评论(0)
推荐(0)
摘要:
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 co... 阅读全文
posted @ 2015-02-09 14:16
Vae永Silence
阅读(155)
评论(0)
推荐(0)