Vista Interview Question

Design a solution for this coding problem