Senior engineer interview questions shared by candidates
We have m slots for ads and n ads, each ads will have different revenue on differnet slot, design an algorithm to find out the best fit (find m ads in n ads and order them so that they can make max money, white board coding) .
It's a standard bipartite matching problem, aka assignment problem. Solutions are standard as well, but none of them are easy. They cannot be figured out during the interview, you just have to know them. These types of questions just make me wonder about those who ask those questions. What exactly do they test? How long have you been from college where you studied Ford-Fulkerson maximum flow algorithm, or Hungarian algorithm (both applicable to the problem)? Show me an interviewer who can answer this question, unless he or she specially prepared it for an interview, thus wasting his productive time at work? And, by the way, trying to use textbook algorithms for real life assignment problems would lead to the results that are mediocre at best. Commercial-strength packages have lots of optimizations for special cases of input data. For instance, the Linux qsort command uses 3 different sorting algorithms depending on the size of input data.
maybe the interviewers just want to test whether you realize (in reasonable) time that this is a non-trivial problem to solve.
If one add can go into multiple slots then this is a simple problem. For every slot you can check which add gives maximum revenue. It is of order (m*n). Then how many adds can one slot take? If one slot can take as many adds as possible then you can put all the adds into most profitable slots leaving some empty. Again a simple solution. If an add can only go into one slot and each slot can take only one add (m>=n), then it is a complicated problem. May be interviewer wants to see if you can separate those cases.
See Interview Questions for Similar Jobs
- Software Engineer
- Software Developer
- Software Development Engineer
- Staff Software Engineer
- Principal Software Engineer
- Senior Software Developer
- Product Manager
- Software Engineer III
- Senior Software Development Engineer
- Software Engineer II
- Data Scientist
- Project Manager
- Vice President
- Software Development Engineer II
- Engineering Manager
- Java Developer