Using c++ stl we can get max and min in 0(1)

just create a set(which internally is implemented as a tree) and get the max and min in 0(1)

insertion in set takes log(n) time

even c++STl’s “min” and “max” takes O(n) time because it traverses through the entire array.
We can only get min and max in O(1) time iff the given array is sorted otherwise it at least takes O(n) time…

Seeking might take O(1) time but constructing the set itself will take O(NlogN) time .

This STL in your comment are implemented using binary trees and their execution takes O(NlogN) times. So, its never O(1).

No its never ever O(1).
While you insert the elemeent it takes logN comp each time so to insert N element we need NlogN time
Regarding min and max yes yo get them in O(1) as we simply resturn 1st and last element of set
But to create it NlogN is needed

Click here to start solving coding interview questions