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

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

Kotlin by JetBrains

Kotlin by JetBrains

Күн бұрын

Пікірлер: 4
@PushkarAgnihotri-ll4vv
@PushkarAgnihotri-ll4vv 18 күн бұрын
Part 1- way of thinking for the solution is amazing
@WayneBagguley
@WayneBagguley 19 күн бұрын
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 18 күн бұрын
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 18 күн бұрын
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,4 М.
Advent of Code 2024 in Kotlin - Office Edition! Day 6.
1:16:20
Kotlin by JetBrains
Рет қаралды 2,2 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
But Java has pattern matching!
1:15:03
Kotlin by JetBrains
Рет қаралды 5 М.
Advent of Code 2024 in Kotlin... and beyond?! Day 8.
1:18:14
Kotlin by JetBrains
Рет қаралды 1,5 М.
Live from the Attic: 2024 Advent of Code Day 1
2:36:34
Leo Laporte
Рет қаралды 1 М.
(Neo)Vim Made Me a Better Software Developer
40:27
vim-jp
Рет қаралды 44 М.
Advent of Code 2024 in Kotlin with The Visualizer! Day 7.
1:31:56
Kotlin by JetBrains
Рет қаралды 1,7 М.
Advent of Code 2024 in Kotlin with Compose Multiplatform! Day 9.
1:20:58
Kotlin by JetBrains
Рет қаралды 1,6 М.
Keynote: Advent of Code, Behind the Scenes - Eric Wastl
46:01
Kotlin 2.1 Livestream with the Language Evolution Team
1:16:10
Kotlin by JetBrains
Рет қаралды 4,9 М.
The Return of Procedural Programming - Richard Feldman
52:53
ChariotSolutions
Рет қаралды 50 М.
Going from Swift to Kotlin with Skip | Talking Kotlin #135
1:04:59
Kotlin by JetBrains
Рет қаралды 3,6 М.