about summary refs log tree commit diff
path: root/day01.ijs
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-12-02 13:34:36 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-12-02 13:34:36 +0100
commit4fcb892b97f7bbdba4c2a873e4493a00722ef40e (patch)
tree9a4ef2178491784c57aebc7046eedcad1ebc80cc /day01.ijs
parent68f50ebf838f4c1e2764d65db5ce606cf101eaf3 (diff)
downloadadventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.tar.gz
adventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.tar.xz
adventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.zip
day01
Diffstat (limited to 'day01.ijs')
-rw-r--r--day01.ijs8
1 files changed, 8 insertions, 0 deletions
diff --git a/day01.ijs b/day01.ijs
new file mode 100644
index 0000000..697d9dd
--- /dev/null
+++ b/day01.ijs
@@ -0,0 +1,8 @@
+load 'aoc.ijs'
+d =: nums 'day01'
+
+*/ {: (#"1~ 2020&=@:(+/)) |:,/,"0/~ d                       NB. 805731
+([ * 2020 - [) (<./ (i. (2020&-)) d) { d                    NB. bit faster
+*/2{.d/:(2020-d)i.d                                         NB. shortest
+
+*/ {:"1 (#"1~ 2020&=@:(+/)) |: d {~ ((#: i.@(*/)) 3 ## d)   NB. 192684960