chore(pre-commit): autoupdate
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
b3b129a03e
commit
a29c0008d8
2 changed files with 10 additions and 9 deletions
|
@ -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
|
||||
|
|
13
src/Utils.kt
13
src/Utils.kt
|
@ -75,13 +75,14 @@ fun readInputAsCommaSeparatedInts(
|
|||
fun readGraph(
|
||||
day: Int,
|
||||
name: String,
|
||||
) = 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
|
||||
) = 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()
|
||||
currentGraph + mapOf(fromVertex to fromNeighbours, toVertex to toNeighbours)
|
||||
}.toMap()
|
||||
|
||||
/**
|
||||
* Constructs product of two sequences.
|
||||
|
|
Loading…
Reference in a new issue