Towers of Hanoi

FCC link

Solve the Towers of Hanoi problem.

Your solution should accept the number of discs as the first parameters, and three string used to identify each of the three stacks of discs, for example towerOfHanoi(4, 'A', 'B', 'C'). The function should return an array of arrays containing the list of moves, source -> destination.

For example, the array [['A', 'C'], ['B', 'A']] indicates that the 1st move was to move a disc from stack A to C, and the 2nd move was to move a disc from stack B to A.

Test

{{test}}

Console output