0

I have two arrays:

ranges  = [[50, 60], [100, 100], [5000, 6000]]
exclude = [[1000, 1000], [5060, 5060]]

How to get the result as a sorted list that is

[[50, 60], [100, 100], [5000, 5059], [5061, 6000]]

Basically, remove the ranges of the second list from the ranges of the first list, creating new ranges where needed.

More examples:

ranges  = [[2, 124235]]
exclude = [[2000, 3000], [400, 2500]] 

that gives me output

[[2, 399], [3001, 124235]]
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
barcaman
  • 107
  • 11
  • Did you try anything that you actually need help with? – Tomerikoo Dec 02 '20 at 10:06
  • 3
    Does this answer your question? [Subtract Overlaps Between Two Ranges Without Sets](https://stackoverflow.com/questions/6462272/subtract-overlaps-between-two-ranges-without-sets) – Koen G. Dec 02 '20 at 10:18

0 Answers0