Skip to content

Commit f7a6add

Browse files
committed
746.min_cost_climbing_stairs in-progress
1 parent 43f8092 commit f7a6add

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
|347|[Top K Frequent Elements](./leetcode/0347.top_k_frequent_elements/)|[Go](./leetcode/0347.top_k_frequent_elements/347.top_k_frequent_elements.go)|Medium|Completed|
2424
|359|[Logger Rate Limiter🔒](./leetcode/0359.logger_rate_limiter/)|[Go](./leetcode/0359.logger_rate_limiter/359.logger_rate_limiter.go)|Easy|Completed|
2525
|379|[Design Phone Directory🔒](./leetcode/0379.design_phone_directory/)|[Go](./leetcode/0379.design_phone_directory/379.design_phone_directory.go)|Medium|In-progress|
26+
|746|[Min Cost Climbing Stairs](./leetcode/0746.min_cost_climbing_stairs/)|[Go](./leetcode/0746.min_cost_climbing_stairs/746.min_cost_climbing_stairs.go)|Easy|In-progress|
2627
|1929|[Concatenation of Array](./leetcode/1929.concatenation_of_array/)|[Go](./leetcode/1929.concatenation_of_array/1929.concatenation_of_array.go)|Easy|Completed|
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package data_structures_algorithms
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# [746. Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/?envType=daily-question&envId=2023-10-13)
2+
You are given an integer array `cost` where `cost[i]` is the cost of the <code>i<sup>th</sup></code> step on a staircase. Once you pay the cost, you can either climb one or two steps.
3+
4+
You can either start from the step with index `0`, or the step with index `1`.
5+
6+
Return *the minimum cost to reach the top of the floor*.
7+
8+
#### Example 1:
9+
```
10+
Input: cost = [10,15,20]
11+
Output: 15
12+
Explanation: You will start at index 1.
13+
- Pay 15 and climb two steps to reach the top.
14+
The total cost is 15.
15+
```
16+
#### Example 2:
17+
```
18+
Input: cost = [1,100,1,1,1,100,1,1,100,1]
19+
Output: 6
20+
Explanation: You will start at index 0.
21+
- Pay 1 and climb two steps to reach index 2.
22+
- Pay 1 and climb two steps to reach index 4.
23+
- Pay 1 and climb two steps to reach index 6.
24+
- Pay 1 and climb one step to reach index 7.
25+
- Pay 1 and climb two steps to reach index 9.
26+
- Pay 1 and climb one step to reach the top.
27+
The total cost is 6.
28+
```
29+
<br>
30+
31+
#### Constraints:
32+
- `2 <= cost.length <= 1000`
33+
- `0 <= cost[i] <= 999`

0 commit comments

Comments
 (0)