Currencycloud Interview Question

Big O for each solution