fixing hanoi solver to allow final stack to be specified