I am trying to enter into a data science job. I gave some internship interviews but have not had luck yet. Last week, I gave an interview where one of the panellists asked one hypothetical question:
“Imagine you have asked to write an algorithm to control traffic light system with a goal to keep road user happy. What approach would you take to design such algorithm”.
I was not able to give a good answer and lost the opportunity. I know about some approaches to designing algorithms such as dynamic programming, greedy method etc. However, none of them seems to be fit to the question asked by panellists. Since then I am curious about what approach can be used to design an algorithm to tackle the real-time problem.
Could anyone shed light on this question?
Well, how would traffic lights work, ideally? It doesn’t make a blind bit of difference how much you’ve memorised various techniques, the question should be able be answered, with some thought, by anyone who has encountered traffic lights over a period of time and understands when they work well or when they don’t (so most adults, if they think about it carefully, should be able to give a sensible answer here)
The things you’re talking about are optimisations for specific problems. You, as programmer, should be able figure out the what the algorithm is in English (or your language of you’re not English), and the programming part is to turn that into instructions, then you look at optimisations and refinements. The trick is to generalise the problem, but this particular problem already being programmatic makes that stage much easier. And as a programmer, you can give a much more concise final answer, but at core the question is still asking about how a system that is well understood by most people (even if they’ve never thought about it too much) works when it works well.
There may be some technique that was specifically written to optimise traffic light systems, if you can find that and memorise it you can probably parrot it back in an interview situation, but I think actually thinking about the problem and figuring out what should happen would be more favourably looked on in many situations.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.