Codility: TreeHeight

Photo by veeterzy on Unsplash

Test Page: https://app.codility.com/programmers/trainings/4/tree_height/

Solution

Explains

  1. On the first node, fire the ‘calculate’ method, and it goes to repeat until the child node hasn’t any child node of itself.
  2. On the progress, the ‘max’ variable is contained on the ‘calculate’ method, and it is going to be incremented when it has any child.
  3. The max parameter is received as ‘inout’ parameter, so when it has been updated, the change is not saved local on the method, it’s going to be updated on the top (at the solution method)

Evaluation

--

--

--

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Deque Data Structure Explained

Python Typed Annotations

Implementing Apple Login in Ionic 5 Capacitor with Laravel API

Importance of good communication between Developers and QAs

SharePoint 2013 PreRequisite Installer Failing — Unable to Install IIS

CAT 3408 | Used Marine Diesel Generator for Sale — CAT 3408 Marine and

Leverage use cases to identify different types of required tests

Guide — Sentry Integration with Unreal Engine 4

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fredric Cliver

Fredric Cliver

Majored in Physics, self-taught and worked in the IT industry as a Dev/Design/Planning for 11 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧

More from Medium

Escape 2042 Review

Wow, what a team!

CoreDump: The Mourning….

Create a nav bar with React Routers