Skip to content

Commit

Permalink
create day 42 problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiShouWu committed Aug 29, 2021
1 parent 65bc307 commit a302630
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 2021-08/2021-08-26 (day39)/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 70. Climbing Stairs
**# 70. Climbing Stairs

`Easy`

## Description

<p>You are climbing a staircase. It takes <code>n</code> steps to reach the top.</p>

<p>Each time you can either climb <code>1</code> or <code>2</code> steps. In how many distinct ways can you climb to the top?</p>
<p>Each time you can either climb <code>1</code> or <code>2</code> steps. In how many distinct ways can you climb to the top?</p>**

<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
Expand Down
1 change: 1 addition & 0 deletions 2021-08/2021-08-28 (day41)/AGO/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ function canJump(nums: number[]): boolean {
}
return zeroIndex == -1;
};

26 changes: 26 additions & 0 deletions 2021-08/2021-08-29 (day42)/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Day 42 Binary Heap

Extend and implement a bianry heap class below.

```ts
abstract class BinaryHeap{
// type: true is max heap, false is min heap
// default min heap
constructor(heap:number[], type?: bool = false);

private heap: number[]; // store value inside heap
private type: bool;
private heapify(): void; // sort heap

public IsEmpty(): bool; // if heap is empty, return true
public root(): number; // return value of root
public pop(): number; // pop root value and remove from heap
public push(value: number); // insert a value into heap and call heapify to sort
}
```

Here is some introduction

http://alrightchiu.github.io/SecondRound/priority-queuebinary-heap.html

https://medium.com/@Kadai/%E8%B3%87%E6%96%99%E7%B5%90%E6%A7%8B%E5%A4%A7%E4%BE%BF%E7%95%B6-binary-heap-ec47ca7aebac
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
| 039 | [70][0070] | [Climbing Stairs](<./2021-08/2021-08-26%20(day39)>) | ![Easy][Easy] | Math; Dynamic Programming; Memoization |
| 040 | [747][0747] | [Min Cost Climbing Stairs](<./2021-08/2021-08-27%20(day40)>) | ![Easy][Easy] | Array; Dynamic Programming |
| 041 | [55][0055] | [Jump Game](<./2021-08/2021-08-28%20(day41)>) | ![Medium][Medium] | Array; Dynamic Programming; Greedy |

| 042 | | [Binary Heap](<./2021-08/2021-08-29%20(day42)>) | ![Medium][Medium] | Heap; Priority Queue; |


---
Expand Down

0 comments on commit a302630

Please sign in to comment.