### Bianca Gandolfo PRO

Slide decks for learning JavaScript

Greedy

slides.com/bgando/greedy

slides.com/bgando/greedy

slides.com/bgando/greedy

Greedy Technique

```
@BIANCAGANDO
```

Text

```
@BIANCAGANDO
```

Text

```
@BIANCAGANDO
```

```
@BIANCAGANDO
```

Locally Optimal Solution

```
@BIANCAGANDO
```

Locally Optimal Solution

Total: 14

```
@BIANCAGANDO
```

Locally Optimal Solution

Total: 13

```
// There is one meeting room.
// There are n meetings represented by two arrays
var start = [1, 3, 0, 5, 8, 5]
var end = [2, 4, 6, 7, 9, 9]
// What is the maximum number of meetings
// that can be accommodated in the meeting room?
```

```
@BIANCAGANDO
```

```
var maxMeetings = function(start, end){
//solve here
}
var start = [1, 3, 0, 5, 8, 5]
var end = [2, 4, 6, 7, 9, 9]
maxMeetings(start, end)
```

```
@BIANCAGANDO
```

We are given N jobs, and their starting and ending times in two arrays. We can't do two jobs simultaneously at a particular moment. If one job ends at the same moment as another job then we can’t do them. We need to check if it is possible to complete all the jobs or not.

Input: ([1,2,3][2,3,4])

Output: true/false. Can you complete all the jobs?

```
@BIANCAGANDO
```

You are the banker in Monopoly with your family who has lost many of the game pieces so you only have bills in these denominations:

$5 $10 $20

You need only pay out your family in the least number of bills possible so you don't run out before the game is over. Write a function that calculates the least number of bills required for any given dollar amount that is divisible by 5.

```
@BIANCAGANDO
```

Advanced Applications

Graph Theory

Minimum Spanning Trees

Traveling Salesman

Thanks!

```
@BIANCAGANDO
```

By Bianca Gandolfo