Kth sorted number from n lists using DP