2336. Smallest Number in Infinite Set
You have a set which contains all positive integers [1, 2, 3, 4, 5, ...]. Implement the SmallestInfiniteSet class: - SmallestInfiniteSet() Initializes the SmallestInfiniteSet object to contain all positive integers. - int popSmallest() Removes and returns the smallest integer contained in the infinite set. - void addBack(int num) Adds a positive integer num back into the infinite set, if it is
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start