Impinge Solutions interview question

write algorithm for array function