Given a range A to B, I need to find what percent of another range overlaps with this range. For example,
Given range 100 - 200.
Another range is say 90-110 ... 50% of this range overlaps with the given range
For 50-250 ... 50% of this range overlaps with the given range
For 20-40 ... 0% of this range overlaps with the given range
For 180-190 ... 100% of this range overlaps with the given range.
Only catch ... I need to do this with as few operations/comparisons as possible.
Thanks in advance!
Start Free Trial