Pregunta de entrevista de Amazon

Algorithm questions, fiding the bugs in the code (array)