Samsung Research America Interview Question

Simple coding question on leetcode