**Problem Statement:** There are 'n' hours in a day and you have 'w' workers. For each worker you will be given 'xp' (work experience), 's' (shift start time) and 'e' (shift end time) on a separate line. Here 's' and 'e' are both inclusive. At any given hour 't' in a day, you have to determine who is the most experienced worker available.

I thought of 2 approaches

a) Keep an interval array of size n. For each worker, from index 's' to 'e' of the array, fill it with 'xp' if current value in the array is lesser. This is memory intensive.

b) Store [xp, s, e] for each worker in a list. Loop through the list for every 't' provided to find the most experienced person. This is CPU intensive.


I want to know which data structure can be used to solve this problem optimally.