2018年1月3日

pow(x,n)

摘要: Implement pow(x, n). Example 1: Example 2: 实现x^n。这里要注意的是n为负数的情况。n为负数时也可以将n转成正数,这样x=1/x。。代码用了另一种方法,见代码。 阅读全文

posted @ 2018-01-03 19:13 夜的第八章 阅读(149) 评论(0) 推荐(0) 编辑

minimun path sum(最小路径和)

摘要: 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 path. 阅读全文

posted @ 2018-01-03 15:43 夜的第八章 阅读(201) 评论(0) 推荐(0) 编辑

unique paths II

摘要: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文

posted @ 2018-01-03 14:58 夜的第八章 阅读(119) 评论(0) 推荐(0) 编辑

combination sum、permutation、subset(组合和、全排列、子集)

摘要: combination sum I、permutation I、subsets I 是组合和、全排列、子集的第一种情况,给定数组中没有重复的元素。 combination sum II、permutation II、subsets II 是组合和、全排列、子集的第而种情况,给定数组中有重复元素。 c 阅读全文

posted @ 2018-01-03 12:56 夜的第八章 阅读(388) 评论(0) 推荐(0) 编辑

subsets II

摘要: Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta 阅读全文

posted @ 2018-01-03 12:22 夜的第八章 阅读(116) 评论(0) 推荐(0) 编辑

subsets(子集)

摘要: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. For ex 阅读全文

posted @ 2018-01-03 11:01 夜的第八章 阅读(152) 评论(0) 推荐(0) 编辑

导航