Samsung Research America interview question

not really difficult