Infosys interview question

Can you write a more optimized code for the same?

Interview Answer

Anonymous

24 Sept 2020

Wrote a bit more optimized and less number of lines.