Pregunta de entrevista de Zendesk

Can you write a working code for these algorithmic challenges?