Garmin interview question

They gave me a code and asked me how I could optimize it.