Here you can find video editorial : SHUFFLE
for other competitive programming courses checkout my channel
CodeNCode
Here you can find video editorial : SHUFFLE
for other competitive programming courses checkout my channel
CodeNCode
that was quick
yup , thanks .
you’re always welcome , your videos always help.
can you make for Positive Mex problem too…
most likely yes
make it man we want it…
that would be really helpful
.
is it necessary to check for decreasing order , it will be sufficient if we check for increasing only?
check for this
4 3
1 1 1 1
i think it will not work for similar elements.
but isn’t it already sorted?
And if you are right ,why did it worked for the first one.
Thankyou for any suggessions.
what if i tried to sort the array and check if the (final_position-currentpos)%k==0.Why does this gives WA in the second subtask??
7 6
3 1 1 1 1 1 1
I think the code fails on this case for example. The answer should be “yes” , but using that method it gives “no”.
Becuase if you check this condition and all numbers are satisfying then also there are cases that will fail a good way to do this is if this condition is true then swap the elements otherwise do i++ but not if this condition is true and after you get out of the for loop check if array is sorted or not.
hey thanks,but can u give any example where it will fail??
thank you