Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (loop [curr 53
- jobs #{98 183 37 122 14 124 65 67 199}
- sum 0]
- (let [[sect dist] (first
- (sort-by last
- (partition 2
- (interleave jobs
- (map
- #(Math/abs (- curr %))
- jobs)))))]
- (if (empty? jobs)
- sum
- (recur
- sect
- (disj jobs sect)
- (+ sum dist)))))
Add Comment
Please, Sign In to add comment