Pergunta de entrevista da empresa DevSoft Philippines

Algorithm question through Hackerrank test