Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advent of Code in Kotlin: Lessons Learned

Advent of Code in Kotlin: Lessons Learned

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

Todd Ginsberg

January 27, 2021
Tweet

More Decks by Todd Ginsberg

Other Decks in Programming

Transcript

  1. Jakub Gwóźdź Solved every puzzle and provided a visualization. In

    Kotlin! jakubgwozdz.github.io/advent-of- code-2020/
  2. Since 2017, I have solved each puzzle each day, in

    Kotlin and blogged about it. https://todd.ginsberg.com
  3. 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>>
  4. val letters = listOf("A", "B", "C", "D") letters.zipWithNext() // [(A,

    B), (B, C), (C, D)] // List<Pair<String,String>>
  5. 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>>