Pregunta de entrevista de Microsoft

Simple two coding questions through codility.