【leetcode】70. Climbing Stairs 每次一阶或两阶爬楼梯

2016-11-07
阅读 1 分钟
4k
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

【leetcode】69. Sqrt(x) 整数开方计算最合适的小的数

2016-11-04
阅读 1 分钟
3.4k
1. 题目 Implement int sqrt(int x). Compute and return the square root of x. 注:对于5,6,7,8等都返回2. 2. 思路 用牛顿开方法计算。原理: [链接] 3. 代码 {代码...}

【leetcode】67. Add Binary 字符串形式的二进制的加法

2016-11-04
阅读 1 分钟
4.7k
1. 题目 Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 2. 思路 从后往前相加和进位。 3. 代码 {代码...}

【leetcode】66. Plus One 用单个数字列表表示的数进行加一返回同样的数字列表形式

2016-11-04
阅读 1 分钟
2.3k
Given a non-negative number represented as an array of digits, plus one to the number.

【leetcode】65. Valid Number 判断字符串是否是一个有效的数字

2016-11-04
阅读 3 分钟
3.8k
Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one.

【leetcode】64. Minimum Path Sum 棋盘最短路径

2016-11-04
阅读 1 分钟
6.2k
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.

【leetcode】63. Unique Paths II 有障碍的棋盘走路路径数量

2016-11-03
阅读 2 分钟
2.7k
Now consider if some obstacles are added to the grids. How many unique paths would there be?

【leetcode】62. Unique Paths 棋盘左上角走到右下角的总走法

2016-11-03
阅读 1 分钟
3.6k
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).

【leetcode】61. Rotate List

2016-11-03
阅读 2 分钟
2.1k
Given a list, rotate the list to the right by k places, where k is non-negative.

【leetcode】60. Permutation Sequence 全排列的第k位序的排列形式

2016-11-03
阅读 2 分钟
3k
By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):

【leetcode】59. Spiral Matrix II 方阵向内循环

2016-11-03
阅读 2 分钟
1.9k
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.

【leetcode】58. Length of Last Word 字符串的末尾词的长度

2016-11-03
阅读 1 分钟
2k
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.

【leetcode】57. Insert Interval

2016-11-02
阅读 2 分钟
2.1k
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).

【leetcode】56. Merge Intervals 相邻线段归并

2016-11-02
阅读 2 分钟
2.6k
For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].

【leetcode】55. Jump Game 数组跳转是否可以到达末节点

2016-11-02
阅读 1 分钟
3.3k
Given an array of non-negative integers, you are initially positioned at the first index of the array.

【leetcode】54. Spiral Matrix 矩阵的螺旋圈向内顺序展开为一维

2016-11-02
阅读 2 分钟
2.5k
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

【leetcode】53. Maximum Subarray 连续子序列的最大和

2016-11-02
阅读 1 分钟
2.6k
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.

【leetcode】52. N-Queens II N皇后问题的解法个数

2016-11-02
阅读 3 分钟
3.2k
Now, instead outputting board configurations, return the total number of distinct solutions.

【leetcode】51. N-Queens 求解N皇后问题的所有解

2016-11-02
阅读 5 分钟
5.3k
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

【leetcode】50. Pow(x, n) 幂计算

2016-11-01
阅读 1 分钟
2.9k
n如果是numeric_limits<int>::min()的值,如果下面的代码中i用int表示,i最后会越界,导致死循环,因为i会变为负数,abs_n会变大,而之后i变为0,abs_n不会再减小,于是就死循环了。

【leetcode】49. Group Anagrams 字母组合相同的单词聚合

2016-11-01
阅读 1 分钟
2.4k
For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:

【leetcode】48. Rotate Image 方块矩阵原地顺时针旋转90°

2016-11-01
阅读 2 分钟
3k
每次旋转最外层的一圈正方形的边,迭代N/2次逐层的将整个都旋转一次。每个正方形的旋转是,用顶边遍历边的每一个节点(最后一个节点除外),将当前正边型的以当前遍历点为左上顶点的内正边型的四个顶点进行旋转。

【leetcode】47. Permutations II 非重复的所有组合

2016-11-01
阅读 2 分钟
2.3k
Given a collection of numbers that might contain duplicates, return all possible unique permutations.

【leetcode】46. Permutations 无重复数组的所有组合形式

2016-10-31
阅读 2 分钟
1.9k
Given a collection of distinct numbers, return all possible permutations.

【leetcode】45. Jump Game II 非负数组的最少跳跃步数

2016-10-31
阅读 2 分钟
3.2k
Given an array of non-negative integers, you are initially positioned at the first index of the array.

【leetcode】44. Wildcard Matching 通配符匹配

2016-10-30
阅读 6 分钟
3k
'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).

【leetcode】43. Multiply Strings 大数乘法

2016-10-28
阅读 3 分钟
3.8k
Given two numbers represented as strings, return multiplication of the numbers as a string.

【leetcode】42. Trapping Rain Water 计算坑洼地的积水量

2016-10-28
阅读 2 分钟
2.8k
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

【leetcode】41. First Missing Positive 求不在给定数组里的最小的正整数

2016-10-28
阅读 1 分钟
3.3k
Given an unsorted integer array, find the first missing positive integer.

【leetcode】40. Combination Sum II 有重复值的整数数组等于指定值的所有子集组合

2016-10-27
阅读 2 分钟
1.7k
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.