Design a class that represents a set containing all positive integers. Support popSmallest() and addBack(num) operations.
Use a pointer for the smallest "unpopped" consecutive integer, and a min-heap for numbers that were added back.
- Maintain cur (next consecutive unpoped, starts at 1) and a min-heap for added-back numbers.
- addedBack Set to avoid duplicates in heap.
- popSmallest: return min(heap.top, cur). If heap non-empty and heap.top < cur, pop heap. Else return cur++.
- addBack(num): if num < cur and not in addedBack, add to heap and set.
- Time Complexity: pop: O(log N), addBack: O(log N)
- Space Complexity: O(N)