SHUFFLE : Codechef LTIME83 Video Editorial

Here you can find video editorial : SHUFFLE

for other competitive programming courses checkout my channel
CodeNCode

8 Likes

that was quick

1 Like

yup , thanks :slight_smile: .

1 Like

you’re always welcome , your videos always help.

1 Like

can you make for Positive Mex problem too…

most likely yes

make it man we want it…

that would be really helpful

:+1: .

is it necessary to check for decreasing order , it will be sufficient if we check for increasing only?

@waqar_ahmad224 SEE THIS I got 1st subtask correct but why the second one is wrong? please tell !!

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.

Very nicely explained thanks @waqar_ahmad224

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