## Microsoft Interview Question

SDE-2s**Country:**United States

Assumption: Each employee has one interval (Start-i, End-i)

Define strucrure :

struct node_t {

time_t time;

int type; // START, END

}

Convert given input into following heterogenous SORTED(by time) list/array with each node of "node_t".

Now scan this list/array with counter = 0, whenever u encounter START_type "++counter" and whenever u encounter START_type "--counter".

Moment when u get counter = 0, that's free time for all employees so just check next START_type to find interval length

- Trushnikov.Ivan December 17, 2015