https://github.com/tidbitsjs/devadvent2021
https://github.com/tidbitsjs/devadvent2021
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tidbitsjs/devadvent2021
- Owner: TidbitsJS
- Created: 2021-12-04T17:40:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T18:17:50.000Z (over 4 years ago)
- Last Synced: 2025-04-07T21:45:38.099Z (about 1 year ago)
- Language: JavaScript
- Size: 8.05 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 🎅 Dev Advent Calendar 2021
The **Dev Advent Calendar** is an initiative by [@themarcba](https://twitter.com/themarcba) in order to give back to the community and learn something on the way.
For every day from the **1st to the 24th of December**, an Xmas-themed coding puzzle is given as a repository to solve.
This repository contains the respective valid solutions for all the puzzles.
# 🧩 Puzzles
## Day 1
Weeks before Christmas, Santa's reindeers start practicing their flying in order to be fit for the big night. Unfortunately, one of them (Rudolf) crashed and landed in the forest 🌲
Now, Santa 🎅 needs YOUR help to find him.
Puzzle: [Puzzle 01](./puzzle-1)
## Day 2
The Elf Coffee Shop has its big reopening after lengthy renovation works during the summer. Not only is it completely modernized, but has also a whole new range of available drinks. In the old coffee shop, the elves could only choose between "Hot Chocolate" and "Coffee". This new coffee shop has a list of various drinks (e.g. Latte, Hot Chocolate, etc.) and optional flavors (e.g. Gingerbread, Peppermint, etc.).
Since this is new and confusing to the elves, especially because the pricing is a bit more complicated than before, the owner of Elf Coffee Shop asked if you could create an automated menu. He would provide you with the name/price of each drink, and the name/price of each available flavor.
It now is your job to create a list of all possible combinations of these drinks (including those without extra flavor), and the pricing.
Puzzle: [Puzzle 02](./puzzle-2)
## Day 3
[Yesterday's puzzle](./puzzle-2) was about creating the menu for the Elf Coffee Shop. The owner was very satisfied with the result.
Due to the high demand, the savy entrepreneur hired someone to make an app where elves can order their drink, and it would be delivered home, or to their workplace.
The only thing missing is a REST API to get the drinks.
It is your job to populate the API with the correct data, so it can be consumed by the app.
Puzzle: [Puzzle 03](./puzzle-3)
## Day 4
You might not know this, but the Elf Post Service 📯 (ECS) is the largest parcel organization in the world. (For obvious reasons though, now that you think about, right?). They are ecologically responsible, so they continuously try to make everything more efficient, also when sending out packages.
That's why they introduced some new box sizes, in order to waste less paper/carton. Before, there were only 3 sizes (S, M, L), now there is a selection of 7 different sizes. This makes it not always that obvious which package is right for which item.
Santa himself asked for your help to develop an algorithm that can select the smallest possible box (but big enough for the item to fit) for any given item.
Puzzle: [Puzzle 04](./puzzle-4)
## Day 5
The elves are about to prepare bags of candy that they want to add to each present this year (you know, everyone had a hard year with Covid still being around and all). Because Santa is a perfectionist, he wants no repeated candy in any of the bags.
He asked you if you could write a program that creates bags of candy that has no repeated candy in it.
Puzzle: [Puzzle 05](./puzzle-5)
## Day 6
You might have heard from the song Santa Claus is Coming to Town the lines:
He's making a list. He's checking it twice. He's gonna find out who's naughty or nice
Well, that is exactly what your task is for today: Write a program that checks a list of kids and analyze whether they were naughty or nice, so that Santa knows if they deserve candy and toys, or coal...
Puzzle: [Puzzle 06](./puzzle-6)
## Day 7
There was a minor accident in the EPS (Elf Postal Service). The door of a delivery truck was not closed correctly, and some gifts fell in the snow.
This caused some name tags to be smudged in a way that some of the letters are not recognized anymore.
It is your task to recuperate the original names from the gift tags.
Puzzle: [Puzzle 07](./puzzle-7)
## Day 8
The elves are organizing a pre-Christmas party, and they want to organize a "secret santa".
It is your job to write an algorithm that selects a secret santa for each participant.
_The concept of "secret santa" is the following: Each participant is assigned a so-called "secret santa", a person that will have to get a thoughtful gift for that person.
Usually this is in-person: All names are thrown in a hat, and each participant draws one. The paper you draw it the person you have to give a gift to. _
Puzzle: [Puzzle 08](./puzzle-8)
## Day 9
Santa received a strange looking file in his mailbox. It looks like it could be a hidden message.
He needs your help to decypher the message in the file.
Puzzle: [Puzzle 09](./puzzle-9)
## Day 10
Winters at the North Pole can be harsh, which not only affects the elves, but also technology.
Some of the train wagons that are used to transport materials, presents, etc. in and out of the North Pole are really old.
In this hash weather, fauly breaks can cause accidents on the tracks.
That is why you help the head mechanic elf to check today's train wagons if they're up to code or not.
Puzzle: [Puzzle 10](./puzzle-10)
## Day 11
Some sections of the North Pole have restricted access, because they contain secrets, like Mrs. Claus's Hot Chocolate Recipe, codes to deactivate the invisibility shield around the village/factory, etc.
These passwords are being changed regularly, and the person that changes it (head elf) just keeps it in his mind. However, it has been noticed that he keeps reusing old passwords.
That's why the board has decided that passwords should be auto-generated.
Puzzle: [Puzzle 11](./puzzle-11)
## Day 12
> This puzzle will be less a puzzle and more a challenge. It will be different from the JavaScript puzzles before 😉
The elves are having a little competition about who makes the most beautiful art about a Christmas tree, and since you've been helping them out a great deal lately, they invited you to participate.
Puzzle: [Puzzle 12](./puzzle-12)
## Day 13
For hundreds of years, the elves have been working with roman numerals. They use it everywhere - in file cabinets, in notes, etc.
This was okay when the numbers were smaller. But some index cards sure are getting big, and the roman version of reading it is just not practical anymore.
Therefore once again the head elf 🧝 counts on your help.
Puzzle: [Puzzle 13](./puzzle-13)
## Day 14
When two elves have to decide who has to do a chore, sometimes they use an ancient game to determine which player will be free of work.
The game is called Earth-Fire-Snow, and it works like this:
The two players choose either one of _snow_, _earth_, or _fire_. Then, at the same time they announce their choice.
The combination of the two defines who wins:
- Fire _melts_ snow
- Snow _covers_ earth
- Earth _extinguishes_ fire
If both players select the same choice, it is a draw.
Your task is it to create a digital version for this, when it comes up when the elves do some work from home.
Puzzle: [Puzzle 14](./puzzle-14)
## Day 15
Elves are extremely looking forward to Christmas. So the closer December 25th gets, the more excited they are.
Therefore Santa decided to make a big display of how much time left until Christmas, **in real-time**.
You are in charge to create this display.
Puzzle: [Puzzle 15](./puzzle-15)
## Day 16
To get home to the North Pole after his big night, Santa uses star constellations.
But after a whole night of delivering presents to children all around the world, he is tired, so that doing the navigation is a hassle.
Since on his way home, his sleigh flies at an altitude where it is not interfering with planes, drones, satellites, or other objects, it is safe to automate this.
Help the elves develop an autopilot for Santa's Sleigh.
Puzzle: [Puzzle 16](./puzzle-16)
## Day 17
While the head elf was replacing all existing password with the number generator made in [puzzle 11](https://github.com/devadvent/puzzle-11), he came upon one specific case where he actually forgot the password.
It is a very old password, when security was not an issue, and we have access to the database to extract the _hashcode_ from the password.
It is your job to extract the password from the given hash code.
Puzzle: [Puzzle 17](./puzzle-17)