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.
Nice kata of the series, well done.
Scala translation
yeah it makes no sense... i would think that null would be a better
What is the reason to have an empty array as an argument in one the tests when
Node
isn't even similar to an array?Since this seems related, I'll piggy-back here... Python now has a fixed sample test with an empty array as input and an expected output of an empty array. Considering the proper input for the function is a
Node
object, not an array, it seems like this should throw an error rather than be treated as an empty tree.if(tree.length > 0) {
trees do not have a
length
property in this kataThis comment is hidden because it contains spoiler information about the solution
The context is non-sensical: a tree having children defined as a list should NEVER have anything else than a list for the children property. A leaf is just a node with an empty list. Using
None/null/...
or anything that isn't a list (or at the very least an iterable, let's say) just implies the initial design is... bad.So:
Cheers
Approved :)
JavaScript translation (author gone)
the original Python solution cannot handle empty trees (aka
None
). i dont know if such a test should be added ?done
done
done
Loading more items...