$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Advent of Code in Kotlin: Lessons Learned
Search
Todd Ginsberg
January 27, 2021
Programming
0
120
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
Share
More Decks by Todd Ginsberg
See All by Todd Ginsberg
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
5
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
8
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
12
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
120
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
150
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
210
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
80
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
56
An Introduction to Kotlin
tginsberg
0
98
Other Decks in Programming
See All in Programming
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
680
JETLS.jl ─ A New Language Server for Julia
abap34
2
450
認証・認可の基本を学ぼう後編
kouyuume
0
250
SwiftUIで本格音ゲー実装してみた
hypebeans
0
490
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
3.8k
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
280
AIコーディングエージェント(Manus)
kondai24
0
210
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.7k
[AtCoder Conference 2025] LLMを使った業務AHCの上⼿な解き⽅
terryu16
5
710
これならできる!個人開発のすゝめ
tinykitten
PRO
0
130
開発に寄りそう自動テストの実現
goyoki
2
1.4k
クラウドに依存しないS3を使った開発術
simesaba80
0
160
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
0
94
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
73
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
37
Designing Powerful Visuals for Engaging Learning
tmiket
0
190
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
2k
Getting science done with accelerated Python computing platforms
jacobtomlinson
0
76
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
210
4 Signs Your Business is Dying
shpigford
186
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Transcript
None
None
Photo by Elena Mozhvilo on Unsplash Photo by Markus Spiske
on Unsplash
None
None
None
None
None
None
None
None
•
• •
• • •
None
2020 Unofficial Advent of Code Survey - Jeroen Heijmans
None
Daniel Lin (@ephemient) Solved every daily puzzle in four different
languages. ephemient.github.io/aoc2020/
Joris Portegies Zwart (@jorispz) Solves puzzles using Kotlin Multiplatform. github.com/jorispz/aoc-2020
Jakub Gwóźdź Solved every puzzle and provided a visualization. In
Kotlin! jakubgwozdz.github.io/advent-of- code-2020/
Courtesy of @FuriousProgramm @FuriousProgramm Also attempting to solve this puzzle.
Manually.
Since 2017, I have solved each puzzle each day, in
Kotlin and blogged about it. https://todd.ginsberg.com
None
•
val letters = listOf("A", "B", "C", "D") val numbers =
listOf(1, 2, 3, 4)
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>>
val letters = listOf("A", "B", "C", "D")
val letters = listOf("A", "B", "C", "D") letters.zipWithNext() // [(A,
B), (B, C), (C, D)] // List<Pair<String,String>>
val letters = listOf("A", "B", "C", "D")
val letters = listOf("A", "B", "C", "D") letters.chunked(2) // [[A,
B], [C, D]] // List<List<String>>
val letters = listOf("A", "B", "C", "D", "E", "F")
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>>
val letters = listOf("A", "B", "C", "D", "E", "F") letters.windowed(3,
3) // [[A, B, C], [D, E, F]]
val letters = listOf("A", "B", "C", "D", "E", "F") letters.windowed(4,
4, false) // [[A, B, C, D]]
val theString = "Hello" theString.padEnd(7, '!') // Hello!!
val theString = "Hello" theString.padStart(7, '!') // !!Hello
val theString = "Left Right"
val theString = "Left Right" theString.substringBefore(" ") // "Left"
val theString = "Left Right" theString.substringBefore(" ") // "Left" theString.substringAfter("
") // "Right"
val someList = listOf("A", "B", "C")
val someList = listOf("A", "B", "C") someList.any { it.length ==
1 } // True!
val someList = listOf("A", "B", "C") someList.all { it.length ==
1 } // True!
val someList = listOf("A", "B", "C") someList.none { it.length ==
2 } // True!
"3".toInt() // 3
"3".toInt() // 3 '3'.toInt() // 51
fun Char.asInt(): Int = this.toString().toInt()
fun Char.asInt(): Int = this.toString().toInt() '3'.asInt() // 3
• •
• • •
• • • •
• • • • •
None
None
None
None
None
None
None