Question d’entretien chez Meta

Two medium-difficulty algorithms, the interviewer was very kind.