摘要: 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 dig... 阅读全文
posted @ 2014-12-09 23:31 陆草纯 阅读(2134) 评论(0) 推荐(0) 编辑
摘要: Text JustificationGiven an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) just... 阅读全文
posted @ 2014-12-09 21:24 陆草纯 阅读(403) 评论(0) 推荐(0) 编辑
摘要: Sqrt(x)Implementint sqrt(int x).Compute and return the square root ofx.解法一:牛顿迭代法求n的平方根,即求f(x)=x2-n的零点设初始值为x0,注,不要设为0,以免出现除数为0,见后。则过(x0,f(x0))点的切线为g(x)... 阅读全文
posted @ 2014-12-09 18:53 陆草纯 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文
posted @ 2014-12-09 15:51 陆草纯 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Set Matrix ZeroesGiven 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 us... 阅读全文
posted @ 2014-12-09 14:11 陆草纯 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Minimum Window SubstringGiven 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).Fo... 阅读全文
posted @ 2014-12-09 13:24 陆草纯 阅读(4953) 评论(1) 推荐(0) 编辑