Revolut interview question

Was that the most efficient solution?