Advent of Code 2023 in Kotlin Day 9

  Рет қаралды 1,996

Kotlin by JetBrains

Kotlin by JetBrains

Күн бұрын

Пікірлер: 1
@JonHagemo
@JonHagemo 11 ай бұрын
Hi. Taking the limited input in mind, then recursion is a possibility in this case. The approach with sequences sounds great, but here it might be a bit over engineering. The calculating approach rocks! Great talk! My naive suggestion: fun getInput(filePath: String): List = java.io.File(ClassLoader.getSystemResource(filePath).file).readLines().map { it.split(" ").map(String::toInt) } fun List.extrapolateNext(): Int = if (this.all { it == 0 }) 0 else this.last() + this.zipWithNext { a, b -> b - a }.extrapolateNext() fun main() { println(getInput("Day09Input.txt").sumOf { it.extrapolateNext() }) println(getInput("Day09Input.txt").sumOf { it.reversed().extrapolateNext() }) }
Advent of Code 2023 in Kotlin Day 10
1:29:00
Kotlin by JetBrains
Рет қаралды 2,9 М.
Keynote: Advent of Code, Behind the Scenes - Eric Wastl
46:01
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Never* use git pull
4:02
Philomatics
Рет қаралды 574 М.
Coding in a Random Programming Language Everyday (Huge Mistake)
17:17
Advent of Code 2024 Go - Day 1: Historian Hysteria
11:29
Josh Ackland
Рет қаралды 2,4 М.
I Scraped the Entire Steam Catalog, Here’s the Data
11:29
Newbie Indie Game Dev
Рет қаралды 515 М.
Advent of Code 2024 in Kotlin with the Core Ecosystem Lead! Day 1.
1:34:00
Kotlin by JetBrains
Рет қаралды 10 М.
going fast is about doing less
19:41
leddoo
Рет қаралды 175 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
Deno got even better!
3:18
Deno
Рет қаралды 41 М.
Day 09 - Advent of Code
20:36
chris biscardi
Рет қаралды 1,6 М.
Day 03 - Advent of Code
30:22
chris biscardi
Рет қаралды 7 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН