Ad
  • Custom User Avatar

    In Python. The instructions say that I should throw an exception for unclean termination. But this code: ssstsnnstsnsssttnnstsnssstnnstsnnnnnsssntnstnnn ends during a subroutine and expects me to NOT throw an exception (I'm passing the test just finishing the program inside the subroutine); meanwhile, this one: ssstntnstntssnssstnnsssnnnn also finishes during a subroutine, but expects me to throw for "empty stack"; it has a push, a pop, and another push; it also ends during the subroutine, so it is unclean but there are no issues with the stack.

    What am I missing?

  • Custom User Avatar

    This shouldn't be a problem for decently sized numbers, but the formula for the lcm is better written as (a // math.gcd(a,b)) * b. This it uses smaller numbers.