Skip to content

Commit

Permalink
update: add advent of code events for 2022 (#3753)
Browse files Browse the repository at this point in the history
* update: add advent of code events for 2022

* update: removed toc and changed the titles
  • Loading branch information
koshachy authored Nov 7, 2023
1 parent 1aa955c commit 02dd9ea
Showing 1 changed file with 108 additions and 34 deletions.
142 changes: 108 additions & 34 deletions docs/topics/advent-of-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,110 @@
every day from December 1 to December 25. With the permission of [Eric Wastl](http://was.tl/), creator of Advent of Code,
we'll show how to solve these puzzles using the idiomatic Kotlin style:

* [](#advent-of-code-2022)
* [](#advent-of-code-2021)
* [](#advent-of-code-2020)

## Advent of Code 2021

* [](#get-ready)
* [](#day-1-sonar-sweep)
* [](#day-2-dive)
* [](#day-3-binary-diagnostic)
* [](#day-4-giant-squid)

### Get ready
## Get ready for Advent of Code

We'll take you through the basic tips on how to get up and running with solving Advent of Code challenges with Kotlin:

* Read our [blog post about Advent of Code 2021](https://blog.jetbrains.com/kotlin/2021/11/advent-of-code-2021-in-kotlin/)
* Use [this GitHub template](https://github.com/kotlin-hands-on/advent-of-code-kotlin-template) to create projects
* Check out the welcome video by Kotlin Developer Advocate, Sebastian Aigner:

<video width="560" height="315" href="6-XSehwRgSY" title="Get Ready for Advent of Code 2021"/>
<video width="560" height="315" href="6-XSehwRgSY" title="Get Ready for Advent of Code 2021"/>

## Advent of Code 2022

### Day 1: Calorie counting

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/1)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 1 | Kotlin](https://www.youtube.com/watch?v=ntbsbqLCKDs)

### Day 2: Rock paper scissors

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/2)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 2 | Kotlin](https://www.youtube.com/watch?v=Fn0SY2yGDSA)

### Day 3: Rucksack reorganization

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/3)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 3 | Kotlin](https://www.youtube.com/watch?v=IPLfo4zXNjk)

### Day 4: Camp cleanup

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/4)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 4 | Kotlin](https://www.youtube.com/watch?v=dBIbr55YS0A)

### Day 5: Supply stacks

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/5)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 5 | Kotlin](https://www.youtube.com/watch?v=lKq6r5Nt8Yo)

### Day 6: Tuning trouble

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/6)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 6 | Kotlin](https://www.youtube.com/watch?v=VbBhaQhW0zk)

### Day 7: No space left on device

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/7)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 7 | Kotlin](https://www.youtube.com/watch?v=Q819VW8yxFo)

### Day 8: Treetop tree house

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/8)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 8 | Kotlin](https://www.youtube.com/watch?v=6d6FXFh-UdA)

### Day 9: Rope bridge

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/9)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 9 | Kotlin](https://www.youtube.com/watch?v=ShU9dNUa_3g)

### Day 10: Cathode-ray tube

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/10)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 10 | Kotlin](https://www.youtube.com/watch?v=KVyeNmFHoL4)

### Day 11: Monkey in the middle

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/11)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 11 | Kotlin](https://www.youtube.com/watch?v=1eBSyPe_9j0)

### Day 12: Hill Climbing algorithm

* Read the puzzle description on [Advent of Code](https://adventofcode.com/2022/day/12)
* Check out the solution in the video:

![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2022 Day 12 | Kotlin](https://www.youtube.com/watch?v=tJ74hi_3sk8)

## Advent of Code 2021

> Read our [blog post about Advent of Code 2021](https://blog.jetbrains.com/kotlin/2021/11/advent-of-code-2021-in-kotlin/)
>
{type="tip"}

### Day 1: Sonar sweep

Expand All @@ -33,7 +117,7 @@ Apply windowed and count functions to work with pairs and triplets of integers.
* Check out the solution from Anton Arhipov on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/12/advent-of-code-2021-in-kotlin-day-1)
or watch the video:

<video width="560" height="315" href="76IzmtOyiHw" title="Advent of Code 2021 in Kotlin, Day 1: Sonar Sweep"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2021 in Kotlin, Day 1: Sonar Sweep](https://www.youtube.com/watch?v=76IzmtOyiHw)

### Day 2: Dive!

Expand All @@ -43,7 +127,7 @@ Learn about destructuring declarations and the `when` expression.
* Check out the solution from Pasha Finkelshteyn on [GitHub](https://github.com/asm0dey/aoc-2021/blob/main/src/Day02.kt)
or watch the video:

<video width="560" height="315" href="4A2WwniJdNc" title="Advent of Code 2021 in Kotlin, Day 2: Dive!"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2021 in Kotlin, Day 2: Dive!](https://www.youtube.com/watch?v=4A2WwniJdNc)

### Day 3: Binary diagnostic

Expand All @@ -53,7 +137,7 @@ Explore different ways to work with binary numbers.
* Check out the solution from Sebastian Aigner on [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/12/advent-of-code-2021-in-kotlin-day-3/)
or watch the video:

<video width="560" height="315" href="mF2PTnnOi8w" title="Advent of Code 2021 in Kotlin, Day 3: Binary Diagnostic"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2021 in Kotlin, Day 3: Binary Diagnostic](https://www.youtube.com/watch?v=mF2PTnnOi8w)

### Day 4: Giant squid

Expand All @@ -63,24 +147,14 @@ Learn how to parse the input and introduce some domain classes for more convenie
* Check out the solution from Anton Arhipov on the [GitHub](https://github.com/antonarhipov/advent-of-code-2021/blob/main/src/Day04.kt)
or watch the video:

<video width="560" height="315" href="wL6sEoLezPQ" title="Advent of Code 2021 in Kotlin, Day 4: Giant Squid"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Advent of Code 2021 in Kotlin, Day 4: Giant Squid](https://www.youtube.com/watch?v=wL6sEoLezPQ)

## Advent of Code 2020

> You can find all the solutions for the Advent of Code 2020 puzzles in our [GitHub repository](https://github.com/kotlin-hands-on/advent-of-code-2020/).
>
{type="tip"}

* [](#day-1-report-repair)
* [](#day-2-password-philosophy)
* [](#day-3-toboggan-trajectory)
* [](#day-4-passport-processing)
* [](#day-5-binary-boarding)
* [](#day-6-custom-customs)
* [](#day-7-handy-haversacks)
* [](#day-8-handheld-halting)
* [](#day-9-encoding-error)

### Day 1: Report repair

Explore input handling, iterating over a list, different ways of building a map, and using the [`let`](scope-functions.md#let)
Expand All @@ -90,7 +164,7 @@ function to simplify your code.
* Check out the solution from Svetlana Isakova on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/07/advent-of-code-in-idiomatic-kotlin/)
or watch the video:

<video width="560" height="315" href="o4emra1xm88" title="Kotlin Tutorial: Advent of Code Puzzles, Day 1"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin With the Kotlin Team: Advent of Code 2020 #1](https://www.youtube.com/watch?v=o4emra1xm88)

### Day 2: Password philosophy

Expand All @@ -101,7 +175,7 @@ function can be helpful to transform your expressions.
* Check out the solution from Svetlana Isakova on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/07/advent-of-code-in-idiomatic-kotlin-day2/)
or watch the video:

<video width="560" height="315" href="MyvJ7G6aErQ" title="Kotlin Tutorial: Advent of Code Puzzles, Day 2"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with The Kotlin Team: Advent of Code 2020 #2](https://www.youtube.com/watch?v=MyvJ7G6aErQ)

### Day 3: Toboggan trajectory

Expand All @@ -112,7 +186,7 @@ function, edit code in the column selection mode, and fix integer overflows.
* Check out the solution from Mikhail Dvorkin on [GitHub](https://github.com/kotlin-hands-on/advent-of-code-2020/blob/master/src/day03/day3.kt)
or watch the video:

<video width="560" height="315" href="ounCIclwOAw" title="Kotlin Tutorial: Adopting a Functional Style for Advent of Code Puzzles"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #3](https://www.youtube.com/watch?v=ounCIclwOAw)

### Day 4: Passport processing

Expand All @@ -123,7 +197,7 @@ utility functions, working with ranges, checking set membership, and matching a
* Check out the solution from Sebastian Aigner on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/09/validating-input-advent-of-code-in-kotlin/)
or watch the video:

<video width="560" height="315" href="-kltG4Ztv1s" title="Kotlin Tutorial: Validating and Sanitizing Input. Advent of Code Puzzles"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #4](https://www.youtube.com/watch?v=-kltG4Ztv1s)

### Day 5: Binary boarding

Expand All @@ -134,7 +208,7 @@ explore powerful local functions, and learn how to use the `max()` function in K
* Check out the solution from Svetlana Isakova on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/09/idiomatic-kotlin-binary-representation/)
or watch the video:

<video width="560" height="315" href="XEFna3xyxeY" title="Kotlin Tutorial: Binary Representation of Numbers. Advent of Code Puzzles"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #5](https://www.youtube.com/watch?v=XEFna3xyxeY)

### Day 6: Custom customs

Expand All @@ -145,7 +219,7 @@ Learn how to group and count characters in strings and collections using the sta
* Check out the solution from Anton Arhipov on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/09/idiomatic-kotlin-set-operations/)
or watch the video:

<video width="560" height="315" href="QLAB0kZ-Tqc" title="Idiomatic Kotlin: Operations with Sets"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #6](https://www.youtube.com/watch?v=QLAB0kZ-Tqc)

### Day 7: Handy haversacks

Expand All @@ -157,7 +231,7 @@ depth-first and breadth-first.
* Check out the solution from Pasha Finkelshteyn on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/09/idiomatic-kotlin-traversing-trees/)
or watch the video:

<video width="560" height="315" href="KyZiveDXWHw" title="Idiomatic Kotlin: Solving Advent of Code Puzzles and Traversing Trees"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #7](https://www.youtube.com/watch?v=KyZiveDXWHw)

### Day 8: Handheld halting

Expand All @@ -169,7 +243,7 @@ use sequences and the `sequence { }` builder function to construct a lazy collec
* Check out the solution from Sebastian Aigner on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/10/idiomatic-kotlin-simulating-a-console/)
or watch the video:

<video width="560" height="315" href="0GWTTSMatO8" title="Sealed Classes, Sequences, Immutability: Idiomatic Kotlin Solving Advent of Code Puzzles"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #8](https://www.youtube.com/watch?v=0GWTTSMatO8)

### Day 9: Encoding error

Expand All @@ -180,7 +254,7 @@ Explore different ways to manipulate lists in Kotlin using the `any()`, `firstOr
* Check out the solution from Svetlana Isakova on the [Kotlin Blog](https://blog.jetbrains.com/kotlin/2021/10/idiomatic-kotlin-working-with-lists/)
or watch the video:

<video width="560" height="315" href="vj3J9MuF1mI" title="Manipulating lists using windowed, scan, firstNotNullOfOrNull: Solving Advent of Code Puzzles"/>
![YouTube](youtube.svg){width=25}{type="joined"} [Learn Kotlin with the Kotlin Team: Advent of Code 2020 #9](https://www.youtube.com/watch?v=vj3J9MuF1mI)

## What's next?

Expand Down

0 comments on commit 02dd9ea

Please sign in to comment.