Advent of Code 2024 in Kotlin with Dave Leeds (and Compose Hot Reload!) Day 4.

  Рет қаралды 2,705

Kotlin by JetBrains

Kotlin by JetBrains

Күн бұрын

Пікірлер: 4
@PushkarAgnihotri-ll4vv
@PushkarAgnihotri-ll4vv 8 күн бұрын
Part 1- way of thinking for the solution is amazing
@WayneBagguley
@WayneBagguley 8 күн бұрын
Part 1 in one line: fun calc(input: List): Int = input.flatMapIndexed { y, s -> s.mapIndexed { x, c -> x to c } .filter { it.second == 'X' }.map { it.first to y } }.sumOf { p -> listOf(0 to -1, 1 to -1, 1 to 0, 1 to 1, 0 to 1, -1 to 1, -1 to 0, -1 to -1) .count { o -> "XMAS".indices.map { input.getOrNull(p.second + it * o.second) ?.getOrNull(p.first + it * o.first) ?: "" }.joinToString("") == "XMAS" } } Part 2 in one line: fun calc(input:List): Int = input.flatMapIndexed { y, s -> s.mapIndexed { x, c -> x to c } .filter { it.second == 'A' }.map { it.first to y } }.count { p -> listOf(listOf(-1 to -1, 0 to 0, 1 to 1), listOf(1 to -1, 0 to 0, -1 to 1)).map{ it.map { s -> input.getOrNull(p.second + s.second) ?.getOrNull(p.first + s.first) ?: "" }.joinToString("").let{ it == "MAS" || it == "SAM" } }.all { it } }
@molasaheb6082
@molasaheb6082 8 күн бұрын
they made their solution so complex that it's just useful for content creations and not any real world usage but they gonna scare away newbees from kotlin 🤣
@donwald3436
@donwald3436 8 күн бұрын
It's nice when CPU and RAM are 100% free you can do whatever you want and everything runs in O(0) time! lol
Advent of Code 2024 with Kotlin Notebooks! Day 5.
1:47:57
Kotlin by JetBrains
Рет қаралды 2,2 М.
Advent of Code Day 1
1:18:54
TheVimeagen
Рет қаралды 73 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 22 МЛН
Advent of Code 2024 in Kotlin... and beyond?! Day 8.
1:18:14
Kotlin by JetBrains
Рет қаралды 1,4 М.
(Neo)Vim Made Me a Better Software Developer
40:27
vim-jp
Рет қаралды 32 М.
Introduction to Ktor by Tomas Zezula
31:32
Kotlin Server Squad
Рет қаралды 1,2 М.
Speed Run: Advent Of Code Day 4 Part 1
17:36
TheVimeagen
Рет қаралды 8 М.
Keynote: Advent of Code, Behind the Scenes - Eric Wastl
46:01
Advent of Code 2024 in Kotlin with Animation Champion Nicole Terc! Day 3.
1:06:25
Why YOU Should Do Advent of Code
4:34
Theo - t3․gg
Рет қаралды 35 М.
Advent of Neovim: Why Neovim?
10:21
TJ DeVries
Рет қаралды 43 М.
Day 3 | Advent of Code 2024
13:58
Errichto Algorithms
Рет қаралды 8 М.