Question d’entretien chez Microsoft

Simple two coding questions through codility.