public ListNode mergeKLists(List<ListNode> lists) {
			int count = 0;
			for (ListNode node : lists) {
				while (node != null) {
					++count;
					node = node.next;
				}
			}
			int[] heap = new int[count + 2];
			int tail = 1;
			for (ListNode node : lists) {
				while (node != null) {
					insert(heap, tail++, node.val);
					node = node.next;
				}
			}
			ListNode root = new ListNode(0);
			ListNode temp = root;
			for (int i = 0; i < count; ++i) {
				temp.next = new ListNode(exact(heap, --tail));
				temp = temp.next;
			}
			return root.next;
		}