N26 interview question

Time and memory complexity of the algorithm.