Uber interview question

Code up a function that meets specific criteria, analyze runtime and optimize.