2526. Find Consecutive Integers from a Data Stream
For a stream of integers, implement a data structure that checks if the last kvalue.
Implement the DataStream class:
- DataStream(int value, int k) Initializes the object with an empty integer stream and the two integers value and k.
- boolean consec(int num) Adds num to the stream of integers. Returns true if the last k integers are equal to value, and false otherwise. If there are less than k integers, the condition does not hold true, so returns false.
1 | class DataStream { |