Question d’entretien chez Google

2 algorithm question on screen--easy to medium