chore(pre-commit): autoupdate

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-12-02 16:06:24 +01:00
parent b3b129a03e
commit a29c0008d8
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
2 changed files with 10 additions and 9 deletions

View file

@ -7,7 +7,7 @@ repos:
- id: check-yaml
- id: check-added-large-files
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
- hooks:
- args:
@ -16,7 +16,7 @@ repos:
exclude: ^\.idea/fileTemplates/.*\.kt$
id: pretty-format-kotlin
repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.14.0
- hooks:
- id: commitizen
@ -24,4 +24,4 @@ repos:
stages:
- push
repo: https://github.com/commitizen-tools/commitizen
rev: v3.15.0
rev: v4.0.0

View file

@ -75,13 +75,14 @@ fun readInputAsCommaSeparatedInts(
fun readGraph(
day: Int,
name: String,
) = readInput(day, name).fold(mapOf<String, Set<String>>()) { currentGraph, edge ->
) = readInput(day, name)
.fold(mapOf<String, Set<String>>()) { currentGraph, edge ->
val (fromVertex, toVertex) = edge.split("-")
val fromNeighbours = currentGraph.getOrDefault(fromVertex, emptySet()) + toVertex
val toNeighbours = currentGraph.getOrDefault(toVertex, emptySet()) + fromVertex
currentGraph + mapOf(fromVertex to fromNeighbours, toVertex to toNeighbours)
}.toMap()
}.toMap()
/**
* Constructs product of two sequences.