Skip to content

Instantly share code, notes, and snippets.

@Gonzih
Forked from skuro/README.md
Last active March 9, 2016 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gonzih/412f5adabc3259b64f5b to your computer and use it in GitHub Desktop.
Save Gonzih/412f5adabc3259b64f5b to your computer and use it in GitHub Desktop.
We made a boo boo
(ns sytac-dojo.core
(:require [clojure.java.io :as io]
[clojure.string :as string]
[clojure.math.combinatorics :as combo]))
(def volume 150)
(defn read-input! []
(as-> "input.txt" $
(io/resource $)
(slurp $)
(string/split $ #"\n")
(map #(Integer/parseInt %) $)))
(read-input!)
(defn power-set [xs]
(reduce (fn [acc x]
(->> acc
(map #(concat (list x) %))
(concat x)))
[[]]
xs))
(let [input (read-input!)]
(count
(sort-by
count
(filter #(= volume
(reduce + %))
(combo/subsets input)))))
(take 200 (combo/subsets (read-input!)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment