I am given an arrangement of valid tower of Hanoi disks. The arrangement is given as an array.
For example [2,2,0]: the indices of the array are the identifiers of the disks, ordered from small to large, and the values of the array are the positions of the corresponding disks (positions are always 0, 1 or 2). In the case of [2,2,0], the smallest two disks are at the third pole, while the largest disk is at the first pole:
| | |
| | [0]
[22222] | [111]
----+---- ----+---- ----+----
Another example: [0,2,1]
| | |
| | |
[0] [22222] [111]
----+---- ----+---- ----+----
Would it be possible to solve the problem recursively for the remaining steps required to move all disks to the target pole (second pole)?
public int solveForSteps(int[] disks){
// Is there a possible way to solve with given arrangements?
}