title: Find all possible combinations from multiple arrays
body: <p>I'm trying to write an algorithm, and due to my lack of experience writing complex algorithms, I'm struggling a bit here. So, in this scenario I have n number of character arrays, each array containing m characters. I need to generate every possible combination of characters between the arrays. </p>
  
  <p>Example, I have the following arrays:</p>
  
  <pre><code>arr1 = [2, 3]
  arr2 = ['y', 1]
  arr3 = [1]
  arr4 = [2, 'u', 4]
  </code></pre>
  
  <p>With the above arrays all of the possible combinations are:</p>
  
  <pre><code>2y12
  2y1u
  2y14
  2112
  211u
  2114
  3y12
  3y1u
  3y14
  3112
  311u
  3114
  </code></pre>
  
  <p>There can be any number n arrays, and any number of characters in each array. So this algorithm needs to scale. I was thinking that a recursive solution might be possible, I just can't wrap my head around how that would work. This problem is very similar to the post <a href="https://stackoverflow.com/q/3093622">Generating all Possible Combinations</a>, except I still don't see how to make the solution dynamic in order to handle any number of arrays with any number of elements within said arrays.</p>
  
  <p>My solution will end up being written in C#, but you can help my with any other language or pseudo code. </p>