Implement stacks, median, and tree path sum | Bytedance Interview Question