File tree Expand file tree Collapse file tree
04.MaximumProductSubarray Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Minimum Path Sum(最小路径和)
2+
3+ LeetCode 64
4+
5+ - [ 英文版] ( https://leetcode.com/problems/minimum-path-sum/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/minimum-path-sum/ )
8+
9+ ## 题目
10+
11+ 给定一个包含非负整数的 m x n 网格,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。
12+
13+ 说明:每次只能向下或者向右移动一步。
14+
15+ 示例:
16+ ```
17+ 输入:
18+ [
19+ [1,3,1],
20+ [1,5,1],
21+ [4,2,1]
22+ ]
23+ 输出: 7
24+ 解释: 因为路径 1→3→1→1→1 的总和最小。
25+ ```
26+
27+ ## 思路
28+ <details >
29+ <summary >点击展开</summary >
30+ // TODO
31+ </details >
32+
33+ ## 代码实现
34+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
35+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
36+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
37+
Original file line number Diff line number Diff line change 1+ # Coin Change (零钱兑换)
2+
3+ LeetCode 322
4+
5+ - [ 英文版] ( https://leetcode.com/problems/coin-change/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/coin-change/ )
8+
9+ ## 题目
10+ 给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回 -1。
11+
12+ 示例 1:
13+ ```
14+ 输入: coins = [1, 2, 5], amount = 11
15+ 输出: 3
16+ 解释: 11 = 5 + 5 + 1
17+ ```
18+
19+ 示例 2:
20+ ```
21+ 输入: coins = [2], amount = 3
22+ 输出: -1
23+ ```
24+
25+ 说明:
26+ 你可以认为每种硬币的数量是无限的。
27+
28+ ## 思路
29+ <details >
30+ <summary >点击展开</summary >
31+ // TODO
32+ </details >
33+
34+ ## 代码实现
35+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
36+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
37+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
38+
Original file line number Diff line number Diff line change 1+ # Best Time to Buy and Sell Stock(买卖股票的最佳时机)
2+
3+ LeetCode 121
4+
5+ - [ 英文版] ( https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/ )
8+
9+ ## 题目
10+
11+ ## 思路
12+ <details >
13+ <summary >点击展开</summary >
14+ // TODO
15+ </details >
16+
17+ ## 代码实现
18+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
19+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
20+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
21+
Original file line number Diff line number Diff line change 1+ # Maximum Product Subarray
2+
3+ LeetCode 152
4+
5+ - [ 英文版] ( https://leetcode.com/problems/maximum-product-subarray/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/maximum-product-subarray/ )
8+
9+ ## 题目
10+ 给定一个整数数组 nums ,找出一个序列中乘积最大的连续子序列(该序列至少包含一个数)。
11+
12+ 示例 1:
13+ ```
14+ 输入: [2,3,-2,4]
15+ 输出: 6
16+ 解释: 子数组 [2,3] 有最大乘积 6。
17+ ```
18+ 示例 2:
19+ ```
20+ 输入: [-2,0,-1]
21+ 输出: 0
22+ 解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。
23+ ```
24+
25+ ## 思路
26+ <details >
27+ <summary >点击展开</summary >
28+ // TODO
29+ </details >
30+
31+ ## 代码实现
32+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
33+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
34+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
35+
Original file line number Diff line number Diff line change 1+ # Climbing Stairs(爬楼梯)
2+
3+ LeetCode 70
4+
5+ - [ 英文版] ( https://leetcode.com/problems/climbing-stairs/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/climbing-stairs/ )
8+
9+ ## 题目
10+ 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。
11+
12+ 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?
13+
14+ 注意:给定 n 是一个正整数。
15+
16+ 示例 1:
17+ ```
18+ 输入: 2
19+ 输出: 2
20+ 解释: 有两种方法可以爬到楼顶。
21+ 1. 1 阶 + 1 阶
22+ 2. 2 阶
23+ ```
24+ 示例 2:
25+ ```
26+ 输入: 3
27+ 输出: 3
28+ 解释: 有三种方法可以爬到楼顶。
29+ 1. 1 阶 + 1 阶 + 1 阶
30+ 2. 1 阶 + 2 阶
31+ 3. 2 阶 + 1 阶
32+ ```
33+
34+ ## 思路
35+ <details >
36+ <summary >点击展开</summary >
37+ // TODO
38+ </details >
39+
40+ ## 代码实现
41+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
42+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
43+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
44+
Original file line number Diff line number Diff line change 1+ # Triangle(三角形最小路径和)
2+
3+ LeetCode 120
4+
5+ - [ 英文版] ( https://leetcode.com/problems/triangle/ )
6+
7+ - [ 中文版] ( https://leetcode-cn.com/problems/triangle/ )
8+
9+ ## 题目
10+ Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
11+
12+ For example, given the following triangle
13+
14+ [
15+ [ 2] ,
16+ [ 3,4] ,
17+ [ 6,5,7] ,
18+ [ 4,1,8,3]
19+ ]
20+ The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).
21+
22+ ## 思路
23+ <details >
24+ <summary >点击展开</summary >
25+ // TODO
26+ </details >
27+
28+ ## 代码实现
29+ | C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
30+ | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
31+ | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
32+
Original file line number Diff line number Diff line change 1+ # 动态规划(Dynamic Programming)
2+
3+ [ 01. Minimum Path Sum(最小路径和)] ( ./01.MinimumPathSum )
4+
5+ [ 02. Coin Change (零钱兑换)] ( ./02.CoinChange )
6+
7+ [ 03. Best Time to Buy and Sell Stock(买卖股票的最佳时机)] ( ./03.BuyAndSellStock )
8+
9+ [ 04. Maximum Product Subarray] ( ./04.MaximumProductSubarray )
10+
11+ [ 05. Climbing Stairs(爬楼梯)] ( ./05.ClimbingStairs )
12+
13+ [ 06. Triangle(三角形最小路径和)] ( ./06.Triangle )
You can’t perform that action at this time.
0 commit comments