Sunday, October 5, 2014

Exercism: "Allergies in Clojure"

I solved the Allergies problem in Clojure.

This is my first iteration of the solution:


And this is the second one which is tail-recursive:


This problem was very interesting. To solve it you need to find a solution for a problem called subset sum. Both iterations use backtracking to find the subset of numbers that sum to the allergies score.

I had used this backtracking algorithm once before to solve the N-Queens problem in Racket for the Introduction to Systematic Program Design 1 Coursera course.

You can nitpick my solution here or see all the exercises I've done so far in this repository.

No comments:

Post a Comment