UKG interview question

Leetcode Easy Question, and System design