Domanda di colloquio di bp

DSA question medium difficulty. and system design.