public ListNode mergeKLists(ListNode[] lists) {
        int size = lists.length;
        if (size == 0)
            return null;
        while (size > 1) {
            int k = (size + 1) / 2;
            for (int i = 0; i < size / 2; ++i) {
                lists[i] = merge(lists[i], lists[i + k]);
            }
            size = k;
        }
        return lists[0];
    }