I am having trouble understanding the last part of the editorial:
" For each value k , we will compute the new prices, sort them and pick the minimum k prices to find the best minimum cost for k items. "
How can we prove this ? That for each value of k, it’s cost will be minimum when we sort it and find the minimum value subarray of k elements ?
Since the cost also depends on the index of the value ie cost = v[i]+index[v[i]]*k
Shouldn’t we find all the possible sub sequence of length k, and then find the minimum among them?