So far what I tried →
Two states say mask
and p
where set bits of mask
denote the array indexes of baby’s array which we will be messing with in current iteration and p
denotes that we need to find minimum moves to perfectly keep first p
elements of baby array to actual valid array.
So we call solve(2^n - 1, k)
.
I want to know if these DP states are fine or we need some other states, if it is can you define those.