0

I need to create an algorithm that gives all possible variation of an array. For example.

getVariations([1,2,3]) ;

should return

 [
   [1,2,3],
   [1,3,2],
   [2,1,3],
   [2,3,1],
   [3,1,2],
   [3,2,1]
 ]

I create a fiddle http://jsfiddle.net/rexonms/uf1xot3x/.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
rex
  • 985
  • 5
  • 28
  • 48

0 Answers0