think-cell interview question

implement a function using STL C++