Zoho interview question

Questions about Optimised approach of problem