Nasdaq interview question

Easy Leetcode, basic algorithm questions