Take root = [1, 2, 3, 4, 5, 6, 7]. This is a complete binary tree with levels.
Level : queue has [1]. Left-to-right flag is on. Collect [1]. Result so far: [[1]].
Level : queue has [2, 3]. Flag flipped to right-to-left. Collect [2, 3], then reverse to [3, 2]. Result: [[1], [3, 2]].
Level : queue has [4, 5, 6, 7]. Flag flipped back. Collect as-is: [4, 5, 6, 7]. Final result: [[1], [3, 2], [4, 5, 6, 7]].
You visit every node once during BFS, so time is . The queue holds at most one full level, which for a complete tree can be up to nodes. Space is .