Mouser Electronics interview question

coding questions were asked to me