Bloomberg interview question

leetcode question of binary tree and system design.