recursion-tree-visualizer icon indicating copy to clipboard operation
recursion-tree-visualizer copied to clipboard

Run code successfully on local machine, But get an error online

Open Bollie15 opened this issue 4 years ago • 0 comments

Here is my code:

coins = [25,20,10,5,1]
def fn(i, m):
    if 0 == m:
        return 0
    if len(coins) == i:
        return 0x3f3f3f3f
    ans = 0x3f3f3f3f
    for k in range(m // coins[i] + 1):
        ans = min(ans, fn(i+1,m-coins[i]*k) + k)
    return ans

print(fn(0,40))

It can run in jupyterlab image

I copy this code to https://recursion.vercel.app/, but it get an error: Your code outputs the following TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' image

I don't know why it can not run online. I hope you can help me. Thanks!😊

Bollie15 avatar Aug 19 '21 13:08 Bollie15