Question d’entretien chez JPMorganChase

time and space complexity of the algorithm