HCLTech interview question

Logic for probabilities