Revolut Interview Question

Was that the most efficient solution?