Solve sliding window and tree BFS problems | Meta Interview Question