Goldman Sachs Interview Question

Easy to medium leetcode question