Question d’entretien chez Zendesk

Can you write a working code for these algorithmic challenges?