Citadel Interview Question

algorithm complexity