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.
Approved by someone
maybe a link to some reading? this is potentially one of the first BT kata people will do. would be good to use it as a deliberate teaching moment
Interesting kata.
Scala translation
Thanks bovard!!
My first true binary tree kata!
Feeling good!!
Hi; I just solved this and I must agree that it was quite frustrating to debug as the output/display of wrong results is not very clear.
Also, you are clearly on the right track - your recursive logic is correct but your base case is where things are going wrong I think.
Using your code, you are failing 3 of the fixed tests - however, none of these correspond to the trees that you have drawn above though (so I'm not sure how you managed to obtain that drawing).
For example, of the 3 test cases where your code is failing, the first one actually is testing the following pair of trees a,b:
and the expected answer is
False
for this input pair.Hopefully that helps you debug a bit better (I can't share with you more of the test cases because otherwise people could just hardcode the correct answer, as there are no random tests).
In Python 3.10, I'm failing a
depth 2
test:Should return false for non-equal trees
.I've verified that my code returns false, but the test fails with 'True should equal False'
The tree structure is
Am I missing something?
Update: I've hard-wired the code to check for this tree, verified the branch with prints statements in the log, but the test fails regardless of whether I return
True
orFalse
Nobody's taken your suggestion for five years. Closing.
Maybe, maybe not.
a
andb
can be null (None
). Null values don't, and can't, have attributes. The error messages says this loud and clear. Try troubleshooting your solution. There is documentation for this.Haskell translation
approved
Lua transaltion, with random tests as well.
COBOL translation, including random tests (author is inactive).
Loading more items...