Samsung Electronics interview question

implementation of library functions