Bloomberg Interview Question

Write a function that calculates the specific value in a tree.