class System { // assume time being used is unique
public:
int getMax() {} //O(1)
int getMin() {} //O(1)
int getRecent() {} //O(1)
void add(long time, int price) {}
void update(long time, int price) {}
void remove(long time) {}
private:
};
Design an array api
Design a array api
Get, Set, SetAll // All operation is O(1)
Get(4) -> get element at index 4
Set(index, value);
SetAll(5) -> set all element to 5
class Array{
private:
public:
Status Get(int index){}
void Set(int index, int val){}
void SetAll(int val){}
};