Code for problem "Partition List".