Sort the values using quick sort -- O(nlogn)
time.
6:00(+)
9:30(-)
9:00(+)
12:30(-)
10:00(+)
10:30(-)
12:14:30(Dude wut?) --> Im going to assume you meant 12:00(+) ,14:30(-)
11:00(+)
13:30(-)
Becomes
6:00(+)
9:00(+)
9:30(-)
10:00(+)
10:30(-)
11:00(+)
12:00(+)
12:30(-)
13:30(-)
14:30(-)
Iterate through the list incrementing for every plus and decrementing for every minus, record the max value found. This takes O(n)
time
Total time O(nlogn + n) = O(nlogn)