Gabriele Ferro Home

Dev Advent Calendar – Day #04

Yesterday, The Elf Coffee Shop needed our help with their app, but today Santa Claus in person asked us to help The Elf Post Service optimize their shipping algorithm.

There are different sizes for each item and boxes and we have to choose the smallest box that can hold our item. Only one item per box.

MY TIP: Items can be rotated.

This puzzle for me relies on array. It can probably be solved in other ways but my approach was to:

It would not be necessary to rotate the boxes (like I did), since they are already in our "ideal position" with:

width >= length >= height

Here is my solution with the output.

MEMO FOR ME: At first I used Array.prototype.forEach() instead of Array.prototype.every() but then I discovered that forEach doesn't GIVE A $h!1 about the break instruction.


  1. Click the participation link
  2. Clone your repository
  3. Solve the puzzle
  4. Test your solution
  5. Add your Twitter handle
  6. Git push your changes

June 2024


Gabriele Ferro Home
Copyright © Ferro Gabriele. All rights reserved.