Veeva Systems interview question

It was leetcode medium problem