Veeva Systems Interview Question

Easy to medium algorithm question