Bloomberg LP Interview Question
Software Engineer / DevelopersAs another example code, let us use vector instead of array assuming the array will be referred multiple times
// pseudo code
// 1. define vector and initialize it with array v[1000]
vector<int> vec(1000);
int i;
for(i=0; i<1000; i++) v.push_back(v[i]);
// 2. use sort algorithm
sort(vec.begin(), vec.end());
std::sort<int *>(v, v+(sizeof(v)/sizeof(v[0])))
- acoader@gmail.com January 28, 2009template type can be omitted above - compiler will infer it.