You are viewing a single comment's thread. Return to all comments →
you are right.
Actually the problem being tested with the test cases is easy. However if you try to solve the problem as defined in GFC, I'd agree that it's not that easy. I actually spent some time trying to solve what GFC describes, but I couldn't get all the test cases to work. When I debugged some of the test cases, I realized that the test cases were all for the simplified case. I then modified my code to support that, and all test cases passed.
After I got all the test cases to work, I actually looked at the editorial, and found the following.
Note: This solution is overly simplified and you will need something more complicated for certain types of imbalanced trees.
Basically the actual problem statement was not well defined. Either the test cases should support all types of trees, and the problem could potentially be made a medium problem. Or the note should have been put in the problem statement, instead of the editorial.