Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Advent of Code in Kotlin: Lessons Learned
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Todd Ginsberg
January 27, 2021
Programming
150
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
61
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
56
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
59
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
180
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
220
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
270
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
110
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
82
An Introduction to Kotlin
tginsberg
0
140
Other Decks in Programming
See All in Programming
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
660
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
すこし踏み込む CancellationToken
htkym
2
1.7k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
カツオ、ご期待ください
suneo3476
0
190
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
460
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
430
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
630
Designing for humans not robots
tammielis
254
26k
Six Lessons from altMBA
skipperchong
29
4.5k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
Optimising Largest Contentful Paint
csswizardry
37
4k
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