mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 21:30:31 +01:00
Implement day 4 part 2.
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
BEGIN {
|
||||
valid=0
|
||||
}
|
||||
{
|
||||
duplicates=0
|
||||
for (i=1;i<=NF;i++) {
|
||||
a[$i]++
|
||||
}
|
||||
for (x in a)
|
||||
{
|
||||
if(a[x]>1)
|
||||
duplicates++
|
||||
}
|
||||
for (x in a)
|
||||
delete a[x]
|
||||
|
||||
if(duplicates==0)
|
||||
valid++
|
||||
}
|
||||
END {
|
||||
print valid
|
||||
}
|
||||
Reference in New Issue
Block a user