We can convert interval list to a list of state change happen at different timestamp, for example, list A = [1,4], [5,8] means enter A at 1, and exit A at 4, then enter A again at 5 and exit A at 8. Similarly list B = [0, 3], [6, 10] means enter B at 0, exit B at 3, enter B at 6, exit B at 10. we can represent these enter/exit events by

(1, +A), (4, -A), (5, +A), (8, -A)

(0, +B), (3, -B), (6, +B), (10, -B)

Then to find common intervals, we can merge two events and sort them by time, e.g.

(0, +B), (1, +A), (3, -B), (4, -A), (5, +A), (6, +B), (8, -A), (10, -B)

Then you can iterate this list and check at every -A or -B point to see if both #A > 0 and #B > 0 at the moment, if yes, that interval is a common interval. So when we check (3, -B) we found both #A > 0 and #B > 0, so [1,3] is a common interval. Then check (8, -A), found [6,8] is common interval.

This method is working on both overlap and non-overlap intervals.