Find the Overlapping Range

Published by MyName in

For a list of ranges, find the maximum range that is contained in all the ranges. If there is no such range, return "No overlapping".

Examples

overlapping([(1, 7), (2, 8), (0, 4)]) ➞ (2, 4)

overlapping([(5, 10), (2, 15), (10, 12)]) ➞ (10, 10)

overlapping([(11, 18), (3, 7), (2, 20), (5, 16)]) ➞ "No overlapping"

Notes

Both ends are inclusive for all ranges.

Watch a quick demo on how Edabit works.