Why are we specifically using a set in this, can you elaborate please?
Unordered set longest subsequence
amortised time complexity of unordered set is O(1) whereas for set is it is O(log(n)) ( for insertion ,deletion and find operation)
but in worst case ordered set performs better than unordered set