It should be nlogn as we are using set.
How Time Complexity is O(n)?
Yes, it should be O(nlogn)
Sorry, it is given unordered_set and its time complexity is O(1)
It should be nlogn as we are using set.
Yes, it should be O(nlogn)
Sorry, it is given unordered_set and its time complexity is O(1)