Domanda di colloquio di BNY

Triple Hackerrank Algorithm question they have asked