Pregunta de entrevista de Amazon

Different problems taken from hackerrank site