ByteDance Interview Question

How to write tree retrieval algorithm