TikTok interview question

Basic leetcode tree and binary search