Apple interview question

Related to integrating interval ranges