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.
Arghh.. Thanks. I have updated the test cases. I missed it because even as arguments solution returns true. Rectified.
Ah, good point. The comment has been fixed. Thank you!
I'm impressed at the success rate despite my difficulty describing the kata. =)
Thanks much!! Got it working : ) The way it works seems a little awkward to me but it's working : ) so what happens in this example if we remove 8? will it then become something like (if i didn't make any mistake while copy-pasting) {value:4,left:{value:2,left:{value:1,left:{},right{}},right{value:3,left:{},right{}}},right{value:12,left:{value:10,left:{value:9,left:{},right{}},right{value:11,left:{},right{}}},right{value:14,left:{value:13,left:{},right{}},right{value:15,left:{},right{}}}}}?
i really thought i had figured this out. i'm also passing all tests except for one, the "Share either 5's subtree or 7's subtree" test.
I don't get it, I tested the following:
All of those print "true", which makes me think that I am sharing all that I can including the 5's subtree. Any clue to what I could be doing wrong? In any case, this has been pretty neat.
This comment is hidden because it contains spoiler information about the solution
That's a great suggestion! I will have to ponder on how I can test operators are not eagerly evaluated in the solutions for this Kata. Let me think about it and I will see if I can improve the tests later today.
The typical approach in such situations is to move a node into the new spot. Go right one and left the whole way to the bottom (or left once and right to the bottom) and put that node in the vacated spot. In those scenarios, you can keep the left (or right) tree untouched. In that test, after removing 6, either the subtree containing 5 or the one containing 7 should be untouched.