上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
摘要: 问题描述:把一个集合的单词按照每行L个字符放,每行要两端对齐,如果空格不能均匀分布在所有间隔中,那么左边的空格要多于右边的空格,最后一行靠左对齐。 words: ["This", "is", "an", "example", "of", "text", "justification."]L: 16. 阅读全文
posted @ 2016-08-17 17:22 32ddd 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 算法分析:利用折半查找,降低算法复杂度。前面求x得y次幂,也是将y/2,都是为了降低复杂度。 阅读全文
posted @ 2016-08-17 15:23 32ddd 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 问题描述: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 阅读全文
posted @ 2016-08-16 19:30 32ddd 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 问题描述:一个数组每一位代表一个数字的每一位。数字高位在数组的低位。求数字加1后得到新数组。 算法分析:要从数组的高位到低位进行遍历。 阅读全文
posted @ 2016-08-16 17:11 32ddd 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 问题描述: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true 阅读全文
posted @ 2016-08-16 16:09 32ddd 阅读(630) 评论(0) 推荐(0) 编辑
摘要: 问题描述:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its p 阅读全文
posted @ 2016-08-16 12:11 32ddd 阅读(272) 评论(0) 推荐(0) 编辑
摘要: UniquePaths:给定m*n矩阵,从(0,0)到(m-1,n-1)路径条数。只能向下向右走。 算法分析:这和爬楼梯问题很像,到(m,n)的路径数是到(m-1,n)和(m,n-1)路径和。第一行,第一列,为边界条件。 UniquePaths2:在上一题基础上,矩阵为1的点是障碍。求路径数。 阅读全文
posted @ 2016-08-15 17:53 32ddd 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
posted @ 2016-08-15 13:32 32ddd 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Merge Interval: Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15 阅读全文
posted @ 2016-08-12 17:54 32ddd 阅读(1047) 评论(0) 推荐(0) 编辑
摘要: SpiralMatrix: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following 阅读全文
posted @ 2016-08-12 13:50 32ddd 阅读(654) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页