bp interview question

DSA question medium difficulty. and system design.