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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Todd Ginsberg
January 27, 2021
Programming
140
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
44
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
44
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
52
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
160
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
200
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
250
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
99
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
76
An Introduction to Kotlin
tginsberg
0
130
Other Decks in Programming
See All in Programming
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
570
Building a Meta Ray-Ban display app
akkeylab
0
180
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
300
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
150
ソフトウェアラスタライザ
fadis
1
620
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.6k
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
730
実装をデザインガイドラインに追従させるための取り組み / 260731-dip-mosh-design-system
dachi023
0
7.7k
メールのエイリアス機能を履き違えない
isshinfunada
0
250
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
2
430
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
170
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
590
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
sira's awesome portfolio website redesign presentation
elsirapls
0
340
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
620
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The untapped power of vector embeddings
frankvandijk
2
1.8k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
380
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
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