Implement a probabilistic data structure that supports add(value) and check(value) without resizing the underlying array. The check method may return occasional false positives but should always correctly identify a true element. Implement a Bloom filter. Input: first line array size n and number of hash functions k, second line number of operations m, then m lines each like "add v" or "check v". Output: results of check operations ("true" or "false"), one per line.
Example 1:
Example 2:
Constraints:
1 <= n <= 10^6 1 <= k <= 5 1 <= m <= 10^4 0 <= v <= 10^9
Tags:
