Bloomberg interview question

valid binary tree