IN the problem colorful slimes you have to pick all color in minimum moves ,
Its mentioned in the editorial for a particular color i we need
min{a[i] , a[i-1] , ... , a[i-k]} . i dont understand how author uses this condition . and should we iterate for each k and then each i or for each i and the each k . how to deal with cycles , that is when we reach last index , how to relate it with first.
Can anyone who solved this problem , share approach .
> < > < >