Veeva Systems interview question

Q. A leetcode hard problem