Apple Interview Question

Related to integrating interval ranges