Question d’entretien chez Amazon

coding question with time complexity analysis