Behavioral Questions:
Problem Solving
/*
I own a company that sells advertisement space on billboards (or a website .. your pick). The billboard slots come in small,
medium, large.
In order to scale, customers can use an online system to purchase billboard slots.
Given a set of different ad boards (Small, Medium, Large) and a sequence of actions, write a control program to accept/reject ads
(also small, medium or large) as they arrive.
Sample Input
Billboard layout is 1 small size, 1 medium size, and 2 large sizes:
[1,1,2]
First sequence Actions:
[(arrival, small), (arrival, large), (arrival, medium), (arrival, large), (arrival, medium)] // arrival large
Expected output:
[1, 2, 3, 4, reject]
Second sequence Actions:
[(arrival, small), (arrival, large), (arrival, medium), (arrival, large), (depart, 3), (arrival, medium)]
Expected output:
[1, 2, 3, 4, 5]
1) If I run out of the slots for that size, I can use the next larger size. I want to be able to pack two small ads into a medium slot, two medium ads in large slow and so on
2) Lots of different bay sizes – not just S, M, L
// one small -> M (I'll use only half of the smaller)
*/