← ALL NOTES
Hash Table

2336. Smallest Number in Infinite Set

Implement SmallestInfiniteSet, initially containing all positive integers 1, 2, 3, …. popSmallest() removes and returns the smallest element; addBack(num) returns num to the set if it isn't already…

Loading…