Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
How does that work since list.append() is not boolean?
ayyyy great minds think alike :D
You're not going to get fib(500) with recursion.
Nice! But it seems to have only passed 5 tests.
Why not do away with the
if
entirely and writen.left and queue.append(n.left)
? That might be obfuscation though, depending on who you ask.it's an habit, knowing that testing explicitly for None is safer than implicit (that cannot happen in the present case, but if you're checking against values or data structures that can be empty, you have to check explicitly for None to avoid to consider falsy things (
[], {}, 0
) as a match forNone
.This comment is hidden because it contains spoiler information about the solution