JS Solution for problem 1 added.
Learned that JS does not have an inbuilt set type
but that it will in ECMAScript 6. Interesting.