Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
    Tweeted twitter.com/StackCompSci/status/1108020445947875329
    Became Hot Network Question
2 added 32 characters in body; edited title
source | link

N segments , find Find a point, shared by maximum segments

Given: N$N$ segments  (arrays) of ordered integers, integers could be from min -K$-K$ to max K$K$.

Example:

Segment1: [-2,-1,0,1,2,3]

Segment2: [1,2,3,4,5]

Segment3: [-3,-2,-1,0,1]

Segment 1: [-2,-1,0,1,2,3]
Segment 2: [1,2,3,4,5]
Segment 3: [-3,-2,-1,0,1]

You can represent them as min[min, max]-max - it is the same :

Segment1: [-2,3]

Segment2it is equivalent: [1,5]

Segment3: [-3,1]

Segment 1: [-2,3]
Segment 2: [1,5]
Segment 3: [-3,1]

FindHow can I find an integer that belongs to the maximum amount of segments.

? For the given example, it is 1.

I look for the most efficient algorithm.

N segments , find a point, shared by maximum segments

Given: N segments(arrays) of ordered integers, integers could be from min -K to max K.

Example:

Segment1: [-2,-1,0,1,2,3]

Segment2: [1,2,3,4,5]

Segment3: [-3,-2,-1,0,1]

You can represent them as min-max - it is the same :

Segment1: [-2,3]

Segment2: [1,5]

Segment3: [-3,1]

Find an integer that belongs to the maximum amount of segments.

For the given example, it is 1.

I look for the most efficient algorithm.

Find a point shared by maximum segments

Given: $N$ segments  (arrays) of ordered integers, integers could be from $-K$ to $K$.

Example:

Segment 1: [-2,-1,0,1,2,3]
Segment 2: [1,2,3,4,5]
Segment 3: [-3,-2,-1,0,1]

You can represent them as [min, max]---it is equivalent:

Segment 1: [-2,3]
Segment 2: [1,5]
Segment 3: [-3,1]

How can I find an integer that belongs to the maximum amount of segments? For the given example, it is 1.

I look for the most efficient algorithm.

1
source | link

N segments , find a point, shared by maximum segments

Given: N segments(arrays) of ordered integers, integers could be from min -K to max K.

Example:

Segment1: [-2,-1,0,1,2,3]

Segment2: [1,2,3,4,5]

Segment3: [-3,-2,-1,0,1]

You can represent them as min-max - it is the same :

Segment1: [-2,3]

Segment2: [1,5]

Segment3: [-3,1]

Find an integer that belongs to the maximum amount of segments.

For the given example, it is 1.

I look for the most efficient algorithm.