Solution to the Week 5 assignment of Algorithm I course on Coursera.