Pregunta de entrevista de Susquehanna International Group

Two programming questions, it was average and had to think only, no complex algorithm.