day 6
parent
4f58128ddc
commit
90c8c7dfde
@ -0,0 +1,13 @@
|
|||||||
|
#lang br
|
||||||
|
(require racket/file racket/set rackunit)
|
||||||
|
|
||||||
|
(define (solve set-proc)
|
||||||
|
(for/sum ([group (string-split (file->string "06.rktd") #px"\n\n+")])
|
||||||
|
(set-count (apply set-proc (for/list ([person (string-split group "\n")])
|
||||||
|
(for/seteqv ([c person])
|
||||||
|
c))))))
|
||||||
|
|
||||||
|
(check-equal? (solve set-union) 6549)
|
||||||
|
|
||||||
|
(check-equal? (solve set-intersect) 3466)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue