Discuss / Python / 一点小bug

一点小bug

Topic source

LesLieM樂

#1 Created at ... [Delete] [Delete and Lock User]
def move(n, a, b, c):
    if n == 1:
        print(a, '->', c)
        return
    move(n-1, a, c, b)
    move(1, a, b, c)
    move(n-1, b, a, c)

一开始忘了return,一直栈溢出-_-|||

LesLieM樂

#2 Created at ... [Delete] [Delete and Lock User]

试了一下,n==979还不会栈溢出,到980就开始溢出


  • 1

Reply