Garmin interview question

there was a leetcode easy problem