N26 Interview Question

Time and memory complexity of the algorithm.