think-cell Interview Question

implement a function using STL C++