WellDev Interview Question

How did you solve this problem ?