Skip to content

Commit

Permalink
Time: 131 ms (26.79%), Space: 46.3 MB (25.04%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Apr 25, 2023
1 parent c43a5ff commit 47c78f3
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class SmallestInfiniteSet {
public:
map<int,int> mp;
SmallestInfiniteSet() {
for(int i =1;i<=1000;i++) mp[i]++;
}

int popSmallest() {
int a = mp.begin()->first;
mp.erase(a);
return a;
}

void addBack(int num) {
mp[num]++;
}
};

0 comments on commit 47c78f3

Please sign in to comment.