Apple Interview Question

Tree recursion problem