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
120
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
2
Loom is more than virtual threads: Structured Concurrency and Scoped Values
tginsberg
0
3
Stream Gatherers: The Missing Link in Java Streams
tginsberg
0
6
Todd Ginsberg April 14, 2024 0 3 Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
120
Loom is More Than Virtual Threads: Structured Concurrency and Scoped Values
tginsberg
0
140
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
200
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
79
Beyond JUnit: Pragmatic Ways to Increase Code Quality
tginsberg
0
56
An Introduction to Kotlin
tginsberg
0
91
Other Decks in Programming
See All in Programming
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
550
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
8
1.5k
KoogではじめるAIエージェント開発
hiroaki404
1
480
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
9
4.6k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
500
チーム開発の “地ならし"
konifar
7
4.5k
All(?) About Point Sets
hole
0
120
AIエージェントでのJava開発がはかどるMCPをAIを使って開発してみた / java mcp for jjug
kishida
4
630
「10分以内に機能を消せる状態」 の実現のためにやっていること
togishima
1
290
「正規表現をつくる」をつくる / make "make regex"
makenowjust
1
410
Agentに至る道 〜なぜLLMは自動でコードを書けるようになったのか〜
mackee
4
1.4k
Bakuraku E2E Scenario Test System Architecture #bakuraku_qa_study
teyamagu
PRO
0
750
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Embracing the Ebb and Flow
colly
88
4.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
We Have a Design System, Now What?
morganepeng
54
7.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
670
Optimizing for Happiness
mojombo
379
70k
Bash Introduction
62gerente
615
210k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Producing Creativity
orderedlist
PRO
348
40k
Navigating Team Friction
lara
190
15k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
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