Optum interview question

Algorithms on array code the same and then optimize