Sollicitatievraag bij Teladoc Health

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