Cleanup
This commit is contained in:
parent
e9e1909c88
commit
607cb130a3
|
@ -3,7 +3,7 @@ import ./common, std/[strutils, sequtils, strformat, sugar, sets, math]
|
||||||
proc parseLine(s: string): seq[seq[string]] = s.split(" | ").mapIt(it.split(" "))
|
proc parseLine(s: string): seq[seq[string]] = s.split(" | ").mapIt(it.split(" "))
|
||||||
|
|
||||||
proc p1(c: seq[string]): int =
|
proc p1(c: seq[string]): int =
|
||||||
c.reduce((a: int, l: string) =>
|
c.reduce((a: int, l) =>
|
||||||
a + l.parseLine()[1].reduce((b: int, h) => b + int(h.len() in [2, 3, 4, 7]), 0), 0)
|
a + l.parseLine()[1].reduce((b: int, h) => b + int(h.len() in [2, 3, 4, 7]), 0), 0)
|
||||||
|
|
||||||
proc numShared(s1: string, s2: string): int = (s1.toHashSet() * s2.toHashSet()).len()
|
proc numShared(s1: string, s2: string): int = (s1.toHashSet() * s2.toHashSet()).len()
|
||||||
|
|
Loading…
Reference in a new issue