Problem Statement
Which operation is stateful and may require examining the whole stream?
Explanation
`distinct` tracks seen elements to remove duplicates, requiring state. `sorted` is also stateful. `filter`, `map`, and `peek` are stateless.
Practice Sets
This question appears in the following practice sets: