Initial soln to chap 6 ex 12 from Algorithm Design book by Kleinberg and Tardos.
Fixed bug in computing cost table.
Refactored code. Completed solution.