Winton Group Interview Question

Binary Trees question on Codility