Ad
  • Custom User Avatar

    Hi lxhoang, Stack level too deep usually means an infinite loop. Try looking into the code where you are using recursion and see if there is a condition that would cause it to never bottom-out.

  • Custom User Avatar

    Hi nwr, MemoryError occurs because call to range(1, n) generates a list e.g. range(1,10) will generate a list: [1, 2, 3, 4, 5, 6, 7, 8, 9]. Use a while loop it will solve your problem.