EY interview question

Question from Leetcode and many on Azure