Todd Ginsberg
January 27, 2021
82

# Advent of Code in Kotlin: Lessons Learned

An introduction to the Advent of Code and what I learned about solving puzzles in Kotlin.

January 27, 2021

## Transcript

on Unsplash

6. ### Daniel Lin (@ephemient) Solved every daily puzzle in four different

languages. ephemient.github.io/aoc2020/

Manually.
10. ### Since 2017, I have solved each puzzle each day, in

Kotlin and blogged about it. https://todd.ginsberg.com

12. ### val letters = listOf("A", "B", "C", "D") val numbers =

listOf(1, 2, 3, 4)
13. ### val letters = listOf("A", "B", "C", "D") val numbers =

listOf(1, 2, 3, 4) letters.zip(numbers) // [(A, 1), (B, 2), (C, 3), (D, 4)] // List<Pair<String,Int>>

15. ### val letters = listOf("A", "B", "C", "D") letters.zipWithNext() // [(A,

B), (B, C), (C, D)] // List<Pair<String,String>>

17. ### val letters = listOf("A", "B", "C", "D") letters.chunked(2) // [[A,

B], [C, D]] // List<List<String>>

19. ### val letters = listOf("A", "B", "C", "D", "E", "F") letters.windowed(3)

// [[A, B, C], [B, C, D], [C, D, E], [D, E, F]] // List<List<String>>
20. ### val letters = listOf("A", "B", "C", "D", "E", "F") letters.windowed(3,

3) // [[A, B, C], [D, E, F]]
21. ### val letters = listOf("A", "B", "C", "D", "E", "F") letters.windowed(4,

4, false) // [[A, B, C, D]]

26. ### val theString = "Left Right" theString.substringBefore(" ") // "Left" theString.substringAfter("

") // "Right"

1 } // True!

1 } // True!

2 } // True!