Samsung Electronics interview question

algorithms