6 Replies Latest reply on Jun 14, 2007 6:03 PM by kglad

    Array shuffle() - how to calculate minimum moves

    coldMiner Level 1
      It's easy to shuffle an array.
      and reorder it to:

      Ok, it's also easy to see that you only need one move to get the Array back to it's original order,
      we just move the [e] two steps to the left.
      But how to make a function that calculates this?

      function deShuffle(arr:Array, answer:String):Number
      // usage example: deShuffle([h,l,p,e], "help");

      Here is a practical example:

      Can anyone help me with this problem?