ADP interview question

Leetcode easy problem