Solve sliding window and tree BFS | Meta