Solution to Tree-Height by codility

29 Jan

Question: https://codility.com/demo/take-sample-test/tree_height

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.

    Miguel

Leave a Reply

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