Optum Interview Question

Algorithms on array code the same and then optimize