Pregunta de entrevista de Skyscanner

Two medium difficulty DSA questions