aboutsummaryrefslogtreecommitdiff
path: root/2021/01/solve.rkt
diff options
context:
space:
mode:
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)