solution to mergeKLists