I am ne zha / Jeskson
I am ne zha / Jeskson
# [70\. 爬楼梯](https://leetcode.cn/problems/climbing-stairs/) ## Description Difficulty: **简单** Related Topics: [记忆化搜索](https://leetcode.cn/tag/memoization/), [数学](https://leetcode.cn/tag/math/), [动态规划](https://leetcode.cn/tag/dynamic-programming/) 假设你正在爬楼梯。需要 `n` 阶你才能到达楼顶。 每次你可以爬 `1` 或 `2` 个台阶。你有多少种不同的方法可以爬到楼顶呢? **示例 1:** ``` 输入:n = 2 输出:2 解释:有两种方法可以爬到楼顶。 1\. 1...
# [64\. 最小路径和](https://leetcode.cn/problems/minimum-path-sum/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [动态规划](https://leetcode.cn/tag/dynamic-programming/), [矩阵](https://leetcode.cn/tag/matrix/) 给定一个包含非负整数的 `_m_ x _n_` 网格 `grid` ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。 **说明:**每次只能向下或者向右移动一步。 **示例 1:**  ``` 输入:grid = [[1,3,1],[1,5,1],[4,2,1]] 输出:7 解释:因为路径 1→3→1→1→1...
# [62\. 不同路径](https://leetcode.cn/problems/unique-paths/) ## Description Difficulty: **中等** Related Topics: [数学](https://leetcode.cn/tag/math/), [动态规划](https://leetcode.cn/tag/dynamic-programming/), [组合数学](https://leetcode.cn/tag/combinatorics/) 一个机器人位于一个 `m x n`网格的左上角 (起始点在下图中标记为 “Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish” )。 问总共有多少条不同的路径? **示例 1:**  ``` 输入:m = 3,...
# [56\. 合并区间](https://leetcode.cn/problems/merge-intervals/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [排序](https://leetcode.cn/tag/sorting/) 以数组 `intervals` 表示若干个区间的集合,其中单个区间为 intervals[i] = [starti, endi] 。请你合并所有重叠的区间,并返回 _一个不重叠的区间数组,该数组需恰好覆盖输入中的所有区间_ 。 **示例 1:** ``` 输入:intervals = [[1,3],[2,6],[8,10],[15,18]] 输出:[[1,6],[8,10],[15,18]] 解释:区间 [1,3]...
# [55\. 跳跃游戏](https://leetcode.cn/problems/jump-game/) ## Description Difficulty: **中等** Related Topics: [贪心](https://leetcode.cn/tag/greedy/), [数组](https://leetcode.cn/tag/array/), [动态规划](https://leetcode.cn/tag/dynamic-programming/) 给定一个非负整数数组 `nums` ,你最初位于数组的 **第一个下标** 。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个下标。 **示例 1:** ``` 输入:nums = [2,3,1,1,4] 输出:true 解释:可以先跳 1 步,从下标 0...
# [53\. 最大子数组和](https://leetcode.cn/problems/maximum-subarray/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [分治](https://leetcode.cn/tag/divide-and-conquer/), [动态规划](https://leetcode.cn/tag/dynamic-programming/) 给你一个整数数组 `nums` ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 **子数组** 是数组中的一个连续部分。 **示例 1:** ``` 输入:nums = [-2,1,-3,4,-1,2,1,-5,4] 输出:6 解释:连续子数组 [4,-1,2,1] 的和最大,为 6 。 ```...
# [49\. 字母异位词分组](https://leetcode.cn/problems/group-anagrams/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [哈希表](https://leetcode.cn/tag/hash-table/), [字符串](https://leetcode.cn/tag/string/), [排序](https://leetcode.cn/tag/sorting/) 给你一个字符串数组,请你将 **字母异位词** 组合在一起。可以按任意顺序返回结果列表。 **字母异位词** 是由重新排列源单词的字母得到的一个新单词,所有源单词中的字母通常恰好只用一次。 **示例 1:** ``` 输入: strs = ["eat", "tea", "tan", "ate", "nat", "bat"]...
# [48\. 旋转图像](https://leetcode.cn/problems/rotate-image/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [数学](https://leetcode.cn/tag/math/), [矩阵](https://leetcode.cn/tag/matrix/) 给定一个 _n _× _n_ 的二维矩阵 `matrix` 表示一个图像。请你将图像顺时针旋转 90 度。 你必须在 旋转图像,这意味着你需要直接修改输入的二维矩阵。**请不要** 使用另一个矩阵来旋转图像。 **示例 1:**  ``` 输入:matrix =...
# [46\. 全排列](https://leetcode.cn/problems/permutations/) ## Description Difficulty: **中等** Related Topics: [数组](https://leetcode.cn/tag/array/), [回溯](https://leetcode.cn/tag/backtracking/) 给定一个不含重复数字的数组 `nums` ,返回其 _所有可能的全排列_ 。你可以 **按任意顺序** 返回答案。 **示例 1:** ``` 输入:nums = [1,2,3] 输出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] ``` **示例 2:** ``` 输入:nums...
# [42\. 接雨水](https://leetcode.cn/problems/trapping-rain-water/) ## Description Difficulty: **困难** Related Topics: [栈](https://leetcode.cn/tag/stack/), [数组](https://leetcode.cn/tag/array/), [双指针](https://leetcode.cn/tag/two-pointers/), [动态规划](https://leetcode.cn/tag/dynamic-programming/), [单调栈](https://leetcode.cn/tag/monotonic-stack/) 给定 `n` 个非负整数表示每个宽度为 `1` 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 **示例 1:**  ``` 输入:height = [0,1,0,2,1,0,1,3,2,1,2,1] 输出:6 解释:上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接...