+ 1
[CHALLENGE] Get all array permutations without mirrored cases
All languages are welcome (JAVASCRIPT preferable). Example Input: [true, false] Output: true, false //"false, true" is the same one since it is a "mirrored" case Input: [a, b, c] Output: abc, acb, bac
7 odpowiedzi
+ 5
bca is a mirror of acb. [Lucas updated]
+ 4
My version
https://code.sololearn.com/cq5o5e3wo5s9
+ 1
Fixed, then.
+ 1
Lucas Sousa Shouldn't the output be nothing for the input a,a,a,a,a,a,a,a ? This is as aaaaaaaa is a mirror image of aaaaaaaa as well, so I think an empty set should be returned.
+ 1
0
First n!/2 permutations is bad because if we have a array such as
[a, a, a, a, a, a, a, a]
will be returned too many equals cases once we just have 1 case ('aaaaaaaa').