Compute rooms and verify tree completeness | TikTok Interview Question