aboutsummaryrefslogtreecommitdiff
path: root/2021/01/solve.rkt
diff options
context:
space:
mode:
authorMarvin Borner2021-12-02 16:11:20 +0100
committerMarvin Borner2021-12-02 16:11:20 +0100
commitf504d00a116a5f8ee090188a98ad54f894a9732b (patch)
treed5baba513cc9b6efae4b81bf5da9fdcc581df1b2 /2021/01/solve.rkt
parentb0fce9d8e9dcbb508a6a5c1e953882a97be1fb34 (diff)
rakete
Diffstat (limited to '2021/01/solve.rkt')
-rw-r--r--2021/01/solve.rkt12
1 files changed, 12 insertions, 0 deletions
diff --git a/2021/01/solve.rkt b/2021/01/solve.rkt
new file mode 100644
index 0000000..4f1401d
--- /dev/null
+++ b/2021/01/solve.rkt
@@ -0,0 +1,12 @@
+#lang racket
+
+(define LINES (map string->number (file->lines "input")))
+
+(define (solve offset)
+ (for/sum ([x (in-list LINES)]
+ [y (in-list (drop LINES offset))]
+ #:when (< x y))
+ 1))
+
+(solve 1)
+(solve 3)