TikTok Interview Question

I forgot, but had to do with a binary tree