Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Advent of Code in Kotlin: Lessons Learned
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Todd Ginsberg
January 27, 2021
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by Todd Ginsberg
See All by Todd Ginsberg
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
36
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
29
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
42
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
150
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
180
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
240
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
95
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
68
An Introduction to Kotlin
tginsberg
0
120
Other Decks in Programming
See All in Programming
Oxcを導入して開発体験が向上した話
yug1224
4
310
OSもどきOS
arkw
0
560
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
490
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
260
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
580
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
650
Oxlintのカスタムルールの現況
syumai
6
1.1k
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.1k
net-httpのHTTP/2対応について
naruse
0
480
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
230
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
200
Bash Introduction
62gerente
615
220k
Facilitating Awesome Meetings
lara
57
7k
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