Code for problem "Merge Intervals".