BSHUFFLE - Editorial

@rajput1999 see below for my code that can check n=10 in a couple of minutes. However any such exhaustive approach isn’t going to get all the way to 17.

thx joffan for your answer

and yeah I also got till N = 8 and then recognized the pattern

however I was curious whether we can go till N = 17 or above

Thanks,I corrected it ,

But with this approach it is showing TLE (time limit exceeded).

help me please .

I found the sequence to be 3,8,11,32,35,56,59,64,67,118,121,208,211,216,219,622,625…
here difference betwween two elements is 3 alternatively but difference between other elements is varying .
I am unable to figure it out ,please help me

Knuth Fisher-Yates Algorithm is worth mentioning.

How can we say that the proof by setter is correct? It just proves that the number of permutations for the least likely is {2}^{N-1} but there is no proof that it would be the least number?

The proof states that it proves “… is the least likely permutation and occurs 2^{M−1} times” however I think it only shows the later. Still you could do a similar induction proof to show that all permutations occur \ge 2^{M-1}.

You can just try go through all possible n^n possible sets of swaps and count the results (up to something like 8 or 9). I can guarantee it’s correct up to n=8, although it should be noted that for odd n there are two equally likely permutations.