You are given a list of stock exchange along with startTime and endTime in which these exchanges operate.
0 <= startTime, endTime <= 23
[
['Exchange A', 2, 7],
['Exchange C', 11, 17],
['Exchange B', 9, 16],
['Exchange D',14, 20]
]Then, given a list of buy/sell orders which need to be executed in the given timeframe you need to find out what all orders can be served with atleast 1 exchange.
[
['Order 1', '3', '6'],
['Order 2', '9', '12'],
['Order 3', '21', '22']
]So in this case Order 1 and 2 can be served but 3 cannot be served by any exchange.
Follow-up = What if some exchanges operate from night to morning, ex - ['Exchange X', 23, 5]. Same thing with orders.