Desquared interview question

Algorithms involving array traversal and value manipulation.