Varicent Interview Question

Solve a easy-medium coding problem