You are not logged in. Please login at to post your questions!


Need help in set.

Given a set of pairs. Each pair represent a range of numbers.

Example : (5, 8) represents {5, 6, 7, 8}.

I want to find in which pair an element x is present, it is sure that element x exits in at least one pair?

Can this be solved in logarithmic time? Thanks in advance!

asked 28 Jan '18, 05:02

chef_keshav's gravatar image

accept rate: 0%

is there are overlapping pairs?

(28 Jan '18, 23:15) pk3012★

Sort, join overlapping pairs, binary search.

(28 Jan '18, 23:31) hemanth_16★

Can you please paste the exact link of question? It will help us to sort out weather it is genuine question or it is not taken from any ongoing contest.

(29 Jan '18, 14:45) bansal12325★

There must be some other constraints too else this would be a very easy problem.Just take min and max value of the set.That would be your answer.


answered 28 Jan '18, 08:58

arnav_mandal's gravatar image

accept rate: 0%

"Can this be solved in logarithmic time?" This is the constraint I guess.

(28 Jan '18, 09:14) harrypotter04★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 28 Jan '18, 05:02

question was seen: 208 times

last updated: 29 Jan '18, 14:45