Problem description is follows:

There are n events for particular day d having start time and duration. Example:

```
e1 10:15:06 11ms (ms = milli seconds)
e2 10:16:07 12ms
......

```

I need to find out the time x and n. Where x is the time when maximum events were getting executed. 

**Solution I am thinking is:**
Scanning all ms in day d. But that request total 86400000\*n calculation. Example

```
Check at 00::00::00::001 How many events are running
Check at 00::00::00::002 How many events are running
Take max of Range(00::00::00::01,00::00::00::00)

```

**Second solution I am thinking is:**

```
For eventi in all events
   Set running_event=1
   eventj in all events Where eventj!=eventi
        if eventj.start_time in Range (eventi.start_time,eventi.execution_time)
           running_event++

```

And then take max of running\_event 

Is there any better solution for this?