public static ListNode mergeKListsNaive(List<ListNode> lists) {//naive solution, TLE
        if (lists == null) return null;
        if (lists.size() == 0) return null;
        if (lists.size() == 1) return lists.get(0);
        ListNode dummy = new ListNode(0);
        ListNode tail = dummy;
        int min_idx = 0;
        int min_val;
        int depleted_cnt;
        ListNode to_insert;
        ListNode t;
        while (true) {
            min_val = Integer.MAX_VALUE;
            depleted_cnt = 0;
            for (int i = 0; i < lists.size(); ++i) {
                if (lists.get(i) == null) {
                    depleted_cnt++;
                }
                else {
                    if (lists.get(i).val < min_val) {
                        min_idx = i;
                    }
                }
            }
            if (depleted_cnt == lists.size()) {
                break;
            }
            //insert
            to_insert = lists.get(min_idx);
            lists.set(min_idx, to_insert == null? null:to_insert.next);
            t = new ListNode(to_insert.val);
            tail.next = t;
            t.next = null;
            tail = t;
        }
        return dummy.next;
    }