Samsung Research America interview question

Simple coding question on leetcode