Goldman Sachs Interview Question

LC - 1 easy and 1 medium question