Pergunta de entrevista da empresa Microsoft

Simple two coding questions through codility.