LeetCode --- 73. Set Matrix Zeroes Feb 19, 2015

 Tags LeetCode , C++ , 数组

题目链接:Set Matrix ZeroesGiven 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... More »

0条评论

LeetCode --- 72. Edit Distance Feb 19, 2015

 Tags LeetCode , C++ , 动态规划 , 字符串

题目链接:Edit DistanceGiven 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 ... More »

0条评论

LeetCode --- 71. Simplify Path Feb 19, 2015

 Tags LeetCode , C++ , , 字符串

题目链接:Simplify PathGiven an absolute path for a file (Unix-style), simplify it.For example,path = “/home/”, => “/home”path = “/a/./b/../../c/”, => “/c”Corner Case... More »

0条评论

LeetCode --- 70. Climbing Stairs Feb 18, 2015

 Tags LeetCode , C++ , 动态规划

题目链接:Climbing StairsYou 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 ... More »

0条评论

LeetCode --- 69. Sqrt(x) Feb 18, 2015

 Tags LeetCode , C++ , 数学 , 二分搜索

题目链接:Sqrt(x)Implement int sqrt(int x).Compute and return the square root of x.这道题的要求是实现int sqrt(int x),即计算x的平方根。考虑二分,即先令l和r分别为1和x/2+1(x的平方根一定小于等于x/2+1),然后m等于(l+r)/2,不断... More »

0条评论

LeetCode --- 68. Text Justification Feb 18, 2015

 Tags LeetCode , C++ , 字符串

题目链接:Text JustificationGiven an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You... More »

0条评论

LeetCode --- 67. Add Binary Feb 17, 2015

 Tags LeetCode , C++ , 数学 , 字符串

题目链接:Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".这道题的要求是两个二进制字符串加法运算。简单的大数加法,只不过是二进制的。处理进位的时候,按... More »

0条评论

LeetCode --- 66. Plus One Feb 17, 2015

 Tags LeetCode , C++ , 数组 , 数学

题目链接:Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the... More »

0条评论

LeetCode --- 65. Valid Number Feb 17, 2015

 Tags LeetCode , C++ , 数学 , 字符串

题目链接:Valid NumberValidate if a given string is numeric.Some examples:"0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It i... More »

0条评论

你在我背后开一枪,我依然相信是枪走了火 Feb 16, 2015

 Tags mky

二战期间,一支部队在森林中与敌军发生激战,最后两名士兵与部队失去了联系。这两名士兵之所以在激战中还能互相照顾、彼此不分,因为他们来自同一个小镇。他们在森林中艰难跋涉,互相鼓励和安慰。十多天过去了,他们仍未与部队联系上。幸运的是,他们打死了一只鹿,依靠鹿肉,又能度过几日了。也许是因为战争的原因,森林中的动物四散奔逃或被杀光,除了那只鹿... More »

0条评论