Nielsen interview question

DSA internship related question sql query