Pregunta de entrevista de IBM

Two hackerank questions were asked