I Solved With Vector, got TLE.
Than Solved With Set, Still TLE.
Than Queue Based Solution,Finally Submitted.
Why??
Strongest Fighter STL C++
The approach using the doubly ended queue is a linear solution O(n) and this is the most optimal. Using set, each insertion would take log n time⦠so queue approach is the most optimal
1 Like