InCred Money interview question

Light house, how to optimise the performance