Question d’entretien chez Google

Coding based problem and SQL question as well