摘要: 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 阅读(288) 评论(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 阅读(224) 评论(0) 推荐(0)