TSMC interview question

Explain your HackerRank problem-solving ideas.