Question d’entretien chez BNY

Can you describe this algorithm's time and space efficiency.