@@ -0,0 +1,1074 @@
+import java.util.Comparator;%0Aimport java.util.PriorityQueue;%0Aimport java.util.Queue;%0A%0Apublic class _0023MergeKSortedLists %7B%0A  public ListNode mergeKLists(ListNode%5B%5D lists) %7B%0A    Queue%3CListNode%3E minStack = new PriorityQueue%3C%3E(new Comparator%3CListNode%3E()%7B%0A      @Override%0A      public int compare(ListNode n1, ListNode n2) %7B%0A        return n1.val - n2.val;%0A      %7D%0A    %7D);%0A    for (ListNode list : lists) %7B%0A      if (list != null) %7B%0A        minStack.add(list);%0A      %7D%0A    %7D%0A    ListNode res = null;%0A    ListNode current = null;%0A    while(!minStack.isEmpty()) %7B%0A      ListNode minNode = minStack.poll();%0A      if (res == null) %7B%0A        res = minNode;%0A        current = minNode;%0A      %7D else %7B%0A        current.next = minNode;%0A        current = minNode;%0A      %7D%0A      if (minNode.next != null) %7B%0A        minStack.add(minNode.next);%0A      %7D%0A    %7D%0A    return res;%0A  %7D%0A%0A%0A%0A  public class ListNode %7B%0A      int val;%0A      ListNode next;%0A      ListNode() %7B%7D%0A      ListNode(int val) %7B this.val = val; %7D%0A      ListNode(int val, ListNode next) %7B this.val = val; this.next = next; %7D%0A  %7D%0A%7D%0A

Add _0023MergeKSortedLists