---
id: 69f8c998d78ad3171a0713bd
title: "Challenge 290: Pizza Party"
challengeType: 28
dashedName: challenge-290
---

# --description--

Given an array of hours worked today per person, return the number of pizzas to order for a pizza party.

- Divide each person's hours worked by 3 to get their slice count.
- You can't eat a partial slice, so round each person's slice count up to the nearest whole number.
- Each person gets a minimum of two slices.
- Each pizza has 8 slices. Round the total number of pizzas up to the nearest whole pizza.

# --hints--

`getPizzasToOrder([8, 8, 8])` should return `2`.

```js
assert.equal(getPizzasToOrder([8, 8, 8]), 2);
```

`getPizzasToOrder([10, 9, 8, 2, 2, 6, 10])` should return `3`.

```js
assert.equal(getPizzasToOrder([10, 9, 8, 2, 2, 6, 10]), 3);
```

`getPizzasToOrder([1, 2, 3, 4, 5])` should return `2`.

```js
assert.equal(getPizzasToOrder([1, 2, 3, 4, 5]), 2);
```

`getPizzasToOrder([8, 8, 8, 8, 8, 8, 8, 8])` should return `3`.

```js
assert.equal(getPizzasToOrder([8, 8, 8, 8, 8, 8, 8, 8]), 3);
```

`getPizzasToOrder([9, 9, 6])` should return `1`.

```js
assert.equal(getPizzasToOrder([9, 9, 6]), 1);
```

`getPizzasToOrder([10, 12, 16, 9, 8, 11, 15, 8, 0])` should return `5`.

```js
assert.equal(getPizzasToOrder([10, 12, 16, 9, 8, 11, 15, 8, 0]), 5);
```

# --seed--

## --seed-contents--

```js
function getPizzasToOrder(hoursWorked) {

  return hoursWorked;
}
```

# --solutions--

```js
function getPizzasToOrder(hoursWorked) {
  const totalSlices = hoursWorked.reduce((sum, hours) => {
    return sum + Math.max(Math.ceil(hours / 3), 2);
  }, 0);

  return Math.ceil(totalSlices / 8);
}
```
