#coding challenge
8 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @naive tusk! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
i hate array ngl
Could you help me bro
too advance for me sorry
Compare all the ranges with all other ranges (n < 10^5, so it should comfortably fit under 1 second). At each iteration try to put the current element into the next available group (let's start with group 1) and each that overlaps. Whenever the current range doesn't overlap with anything else put it into group 0. If it overlaps with a range that has a group assigned record it to some kind set or something. After that use collected data to merge groups that you have to a minimal set. After that it's 2^(x+y) mod 10^9 + 7 where x is a number of indepndent groups and y is a number of elements in group 0.
At least that's what I think. I'll take a second look at that later.