Pregunta de entrevista de Microsoft

mainly algorithm questions and mathematical tricks