Question d’entretien chez Teladoc Health

Implement this function, describe how you would optimize, discuss runtime & complexity.