Pergunta de entrevista da empresa ThousandEyes

Implement a function to return all permutations of an array of arrays: ie input: [[a,b,c], [d,e,f], [g,h,i]] should return permutations adg adh adi aeg aeh ...