Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:21:05+00:00 2026-06-09T12:21:05+00:00

i have tried this problem for quite some time but cannot find a good

  • 0

i have tried this problem for quite some time but cannot find a good solution :

suppose we have ranges of integers like

 100 - 1000
 200 - 300
 500 - 600
 550 - 575
 800 - 1200
 1100 - 2300

so i want to get these intermixing ranges into each separate distinct range

 100 - 199
 200 - 300
 301 - 499
 500 - 549
 550 - 575
 575 - 600
 800 - 1099
 1100 - 1200
 1201 - 2300

is there some standard algorithm for this ?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:21:07+00:00Added an answer on June 9, 2026 at 12:21 pm

    Shove every number into a single array, sort and dedupe. In C++, inserting them all into a std::set<int> has the desired effect. In Python, you can write sorted(set(x for (a, b) in ranges for x in (a, b))).

    In the resulting collection, adjacent pairs represent non-overlapping ranges.

    It’s important to note that this technique relies on the [a, b) convention (i.e., inclusive on the left; exclusive on the right) for describing ranges.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried many ways to solve this problem but none works. suppose I have
I have been wrestling with this problem for quite some time now. I have
I have tried searching over the internet about this problem but not able to
I'm not quite sure what this is called, but I've spent some time thinking
I've seen some similar posts, but nothing quite like this... I have a website
I'm working on this problem for quite some time, and can't get it to
I have tried troubleshooting this problem and just ended up with nothing, I hope
I have tried this approach/hack: http://blog.blackwhale.at/2009/06/uibuttons-in-uinavigationbar/ The problem is this leaves a faint seam.
I have tried this but it does not work (even if I specify .wav
i have tried this code to redirect a php page.but it s not working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.