Pregunta de entrevista de Salesforce

solve an an online algorithm problem in hackerrank