Question d’entretien chez Google

solving with two pointer question