THG Ingenuity interview question

How I approached the task