Veeva Systems Interview Question

It was leetcode medium problem