Top 23 Kotlin aoc-2023-in-kotlin Projects
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Original article: https://blog.jetbrains.com/kotlin/2023/11/advent-of-code-2023-with-kotlin/
Project mention: [2023 Day 2 (Part 1)] [programming language if applicable] Debugging help wanted: `awk`ward solutions with that `gawk` `gawk` 5.11 | /r/adventofcode | 2023-12-09# Games are possible if: red <= 12 && green <= 13 && blue <= 14 # Summate the line numbers, which are equivalent to game IDs: # Summation of line numbers borrowed from https://github.com/xiaowuc1/aoc-2023-kotlin/blob/main/src/Day02.kt; it's more reliable than parsing the integer in arr[0]. # Above solution was viewed after my algorithm was established, but program was not running correctly. { split($0, arr, /[:,;]/) delete redArr # Delete the arrays used in the previous iteration. delete greenArr delete blueArr # To store each count of cubes of a colour, for(i = 2; i < length(arr); i++) { match(arr[i], "[[:digit:]]+", tmp) # Match is stored in tmp[0] if (arr[i] ~ "red") redArr[length(redArr)] = tmp[0] else if (arr[i] ~ "green") greenArr[length(greenArr)] = tmp[0] else blueArr[length(blueArr)] = tmp[0] } # Summate the possible games. if(and(arrmax(redArr, 12), arrmax(greenArr, 13), arrmax(blueArr, 14))) sum += FNR } END { print(sum) } # arrmax(a) := max(a) # arrmax(a,b) := arrmax(a) <= b function arrmax(array, maximum, max) { for(i in array) if(array[i] > max) max = array[i] return (typeof(maximum) == "number") ? (max <= maximum) : max; } #Input example starts immediately following the pound sign. #Game 1: 1 green, 2 blue; 15 blue, 12 red, 2 green; 4 red, 6 blue; 10 blue, 8 red; 3 red, 12 blue; 1 green, 12 red, 8 blue # ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ #arr[1]| arr[2]| arr[3]|
I am not a strong mathematician so I solved part 2 by coming at the range where records happen from both ends of the time range and subtracting. Then I refactored part 1 to do the same. My code can be found on GitHub, I've written this up on my blog, and here are my 2023 Solutions so far.
For the few people that are interested: I did all of them in Kotlin, repo: here
day 1
Repository
Functional style: Solution
[LANGUAGE: Kotlin] 757 / 504 Code
Project mention: What languages have you learnt with AoC and now you love...or ended as "meh"? | /r/adventofcode | 2023-12-09
I'm doing Advent of Code in Kotlin (and Raku but never mind.) Although I use Kotlin quite a bit for Android development, it is only in exercises like these that I really exercise my knowledge of the language. While doing Day 3, I ran into a little problem which I solved but I can't help thinking I could have done better. My entire code can be found on github but here is the essential bit:
Sorry for the late response. The key is to also use await on the first part. I created a gist so you can have a look. The bench function I wrote is here in case you need it.
Solution in Kotlin
Solution on GitHub
Index
What are some of the best open-source aoc-2023-in-kotlin projects in Kotlin? This list will help you:
Project | Stars | |
---|---|---|
1 | advent-of-code-kotlin-template | 593 |
2 | aoc-2023-kotlin | 27 |
3 | advent-2023-kotlin | 14 |
4 | AdventOfCode | 9 |
5 | advent-of-code | 8 |
6 | advent-of-code | 5 |
7 | playground | 3 |
8 | puzzles | 3 |
9 | advent-of-code | 3 |
10 | AdventofCode2023 | 2 |
11 | advent-of-code-2023 | 1 |
12 | aoc_kotlin | 1 |
13 | advent-of-code | 1 |
14 | advent-of-code | 1 |
15 | algorithm-problems | 1 |
16 | aoc2023-kotlin | 0 |
17 | AdventOfCode2023 | 0 |
18 | adventofcode2023 | 0 |
19 | advent-of-code-kotlin | 0 |
20 | aoc2023 | 0 |
21 | advent-of-code-kotlin-template | 0 |
22 | AOC | 0 |
23 | advent-of-code | 0 |
Sponsored