GlobalLogic interview question

Easy Leetcode problem ,and basic cs