Solution for makeOrderedLeafList