code-reviews

jaihindhreddy 2021-05-26T15:30:06.008700Z

Here's a working impl (my take on it):

(defn max-subset-sum [nums]
  (let [nxt
    #(let [n (count %)
           taking (+ %2 (nth % (- n 2) 0))
           not-taking (nth % (dec n) 0)]
        (conj % (max taking not-taking)))]
    (apply max (reduce nxt [] nums))))