mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-06 15:03:08 -05:00
Fix(curriculum): external Tower of Hanoi link in CIP (#46434)
* removed the link * changed description * made example into one sentence and the description into another * Grammar typos Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * Yeab clearer and better description 👌 Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org> * Fix has been made 🛠️ Co-authored-by: Niraj Nandish <nirajnandish@icloud.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org> Co-authored-by: Niraj Nandish <nirajnandish@icloud.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
<p></p>
|
||||
Write a function that returns the moves to stack the objects in a nested array.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user