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
68
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
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
7
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
9
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
86
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
13
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
30
An Introduction to Kotlin
tginsberg
0
54
Three New Features Coming to Java
tginsberg
0
32
An Introduction to Kotlin
tginsberg
0
24
Java Cram Session: Get caught up on the latest Java changes
tginsberg
0
15
Other Decks in Programming
See All in Programming
チーム力を高めるスクラム実践法:カンバン公開と課題攻略について - ニフティのスクラムトーク Vol. 2 - NIFTY Tech Talk #18
niftycorp
PRO
1
110
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
230
Netty Chicago Java User Group 2024-04-17
sullis
0
170
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
見た目から始める生産性向上
ikumatadokoro
7
780
入門 AWS Amplify Gen2 / Introduction to AWS Amplify Gen2
genkiogasawara
1
320
PHPはいつから死んでいるかの調査
chiroruxx
1
370
"config" ってなんだ? / What is "config"?
okashoi
0
240
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
8.2k
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
410
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
360
Featured
See All Featured
A designer walks into a library…
pauljervisheath
199
23k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
Docker and Python
trallard
33
2.7k
Design by the Numbers
sachag
274
18k
KATA
mclloyd
14
12k
GitHub's CSS Performance
jonrohan
1024
450k
Optimizing for Happiness
mojombo
370
69k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Designing with Data
zakiwarfel
95
4.8k
The Cost Of JavaScript in 2023
addyosmani
15
3.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
16
1.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