This problem is related to the classic "Tower of Hanoi" puzzle.
The puzzle consists of three rods and n disks.
The rods are labeled A, B, and C.
The disks all have different sizes, and they are numbered 0 through n-1 from smallest to largest.
In a valid configuration, each disk is placed onto one of the three rods and on each rod the disks are ordered by size: smallest to largest from top to bottom.
In order to specify a configuration we just need to specify the rod for each disk, as the order of disks on each rod is uniquely determined by their sizes.
A valid move is a move in which we take the topmost disk from one of the rods and place it onto the top of the disks on another rod in a way that produces a valid configuration.
That is, given a valid configuration, a move is only valid if a) you are moving the topmost disk from one rod onto another rod that is currently empty, or b) the disk you are moving is smaller than the current topmost disk on the destination rod.
A solution is a sequence of valid moves that produces a configuration in which all n disks are in a single stack on an arbitrary rod.
You are given a int count with three elements and an int k.
Construct any valid configuration with the following properties:
- There are exactly count disks on rod A.
- There are exactly count disks on rod B.
- There are exactly count disks on rod C.
- The shortest solution for this configuration consists of exactly k moves.
If there is no such configuration, return an empty String.
Otherwise, return a String with n = sum(count) characters.
For each valid i, character i of the return value should be the name of the rod where disk i is placed.
If there are multiple possible solutions, you may return any of them.