Money change algorithm as per SICP