[p5] Whoops, part of the code for part 1 was missing

master
Jacopo De Simoi 3 months ago
parent b59b20656b
commit 6bd2a4f48c
  1. 12
      p5/p5.org

@ -17,12 +17,16 @@ First load the data as a list of cons cells (start . end)
This is for part 1
#+begin_src emacs-lisp
(length
(-filter (lambda (id)
(--any (and (>= id (car it))
(<= id (cdr it)))
(-count (lambda (id)
(--any (and (>= id (car it))
(<= id (cdr it)))
ranges))
ids)
#+end_src
#+RESULTS:
: 744
For part 2, sort and merge the ranges (when they are overlapping or
adjacent), then sum their lengths
#+begin_src emacs-lisp

Loading…
Cancel
Save