移动盘子,左中右,倒着移动,n,n-1,n-2

#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param n int整型 
# @return string字符串一维数组
#
class Solution:
    def dp(self, n ,left, mid, right):
#         ans=[]
        if n == 1:
            self.ans.append( "move from " + left + " to " + right)
            return
        else:
            self.dp(n-1 , left, right, mid)//这里有坑,left, right, mid指的是变量
            t = "move from " + left + " to " + right
            self.ans.append(t)
            self.dp(n-1, mid, left, right)
        return 
#         print()
    def getSolution(self , n ):
#         # write code here
#         if n == 1:
#             return(["move from left to right"])
        self.ans=[]
        self.dp(n, 'left', 'mid', 'right')
        return self.ans