diff --git a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md index 4de9c851ba4..9ccf94e0064 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md +++ b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/towers-of-hanoi.md @@ -8,13 +8,13 @@ dashedName: towers-of-hanoi # --description-- -Solve the [Towers of Hanoi](https://en.wikipedia.org/wiki/Towers_of_Hanoi "wp: Towers_of_Hanoi") problem. +Solve the Towers of Hanoi problem. The number of objects will be given as the first parameter, followed by the strings used to identify each stack of objects. Create a nested array containing the list of moves, `["source", "destination"]`. + +For example, the parameters `(4, 'A', 'B', 'C')`, will result in nested array of moves `[['A', 'C'], ['B', 'A']]`, indicating that the 1st move was to move an object from stack `A` to `C` and the 2nd move was to move an object from stack `B` to `A`. -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. +# --instructions-- -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. - -

+Write a function that returns the moves to stack the objects in a nested array. # --hints--