Skip to content

Instantly share code, notes, and snippets.

View g7s's full-sized avatar

Gerasimos g7s

View GitHub Profile

Keybase proof

I hereby claim:

  • I am g7s on github.
  • I am g7s (https://keybase.io/g7s) on keybase.
  • I have a public key ASCrJVdh453xZQORNELSm5pN1o-Q-tlinjYHOcbOUxWS2Qo

To claim this, I am signing this object:

@g7s
g7s / day1.clj
Last active December 1, 2020 17:52
Advent of Code 2020 - Day 1
(defn sum-pair
[target nums]
(when (pos? (count nums))
(let [min-el (get nums 0)
max-el (peek nums)]
(case (compare (+ min-el max-el) target)
1 (recur target (pop nums))
-1 (recur target (subvec nums 1))
0 [min-el max-el]))))