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
Todd Ginsberg
January 27, 2021
Programming
0
130
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
23
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
14
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
28
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
130
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
160
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
220
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
86
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
57
An Introduction to Kotlin
tginsberg
0
110
Other Decks in Programming
See All in Programming
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
180
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
180
OTP を自動で入力する裏技
megabitsenmzq
0
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1k
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
150
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
190
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
250
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
440
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
330
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
150
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
420
The World Runs on Bad Software
bkeepers
PRO
72
12k
Design in an AI World
tapps
0
180
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.4k
The agentic SEO stack - context over prompts
schlessera
0
710
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Google's AI Overviews - The New Search
badams
0
950
Fireside Chat
paigeccino
42
3.8k
A Soul's Torment
seathinner
5
2.5k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
980
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
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