Deloitte interview question

questions from leetcode