ByteDance Interview Question

Bfs question, binary search question