Programming, Coding, Technology, Python, Leetcode.
areas. Look at the below image for a good visualization. How does this apply to the question? We could imagine all the probabilities as distinct, disjoint intervals. For example, given the probabilities- [0.1, 0.5, 0.2, 0.2], you would get the intervals [0, 0.1), [0.1, 0.6), [0.6, 0.8), [0.8, 1].