+ 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

14th Jun 2018, 12:24 AM
Lucas Sousa
Lucas Sousa - avatar
7 Respuestas
+ 5
bca is a mirror of acb. [Lucas updated]
14th Jun 2018, 12:47 AM
John Wells
John Wells - avatar
14th Jun 2018, 3:26 PM
John Wells
John Wells - avatar
+ 1
Fixed, then.
14th Jun 2018, 12:54 AM
Lucas Sousa
Lucas Sousa - avatar
+ 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.
14th Jun 2018, 2:57 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
14th Jun 2018, 7:34 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
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').
14th Jun 2018, 1:41 AM
Lucas Sousa
Lucas Sousa - avatar