Find the minimum cost to convert every type B product to type A.
Unlock detailed company stats for this questionUpgrade
product[i] = 1 means variant B, 0 means variant A. Each operation chooses 0 <= l <= r < n with r-l+1 = k, costs product[l]+...+product[r], and sets one index p in [l, r] to 0. Example: product = [1,1,1,0,1], k = 4 gives total cost 7. Constraints: 1 <= k <= n <= 10^5.
Format · Amazon OA, second of two questions.
Community answers
No answers contributed by the community yet.


