Solution to Tree-Height by codility

29 Jan


Question Name: TreeHeight

Classic recursion problem.

6 Replies to “Solution to Tree-Height by codility

  1. Java version:

    • Thanks for sharing your solution!

      For posting code, please add the code inside a <pre> </pre> section, rather than <code> </code>.

      BTW, the first Math.max is not necessary.

    • Or more simply

  2. Hi Guys! I thought about doing this solution too but isn’t this n^2 time complexity ?
    In the end the performance of my test was not assessed, but other solutions I tried before with recursion were always a bit slow.


Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!