Microsoft interview question

Algorithm about arrays.