The Programming Interview from Hell
21–30 of 147 posts
Re: The Programming Interview from Hell
#22I interviewed someone who gave responses akin to "I'd Google it." When presssed, he did finally give some reasonable answers. We ended up hiring him, as we'd interviewed 10 other candidates who'd failed at that point. He ended up being a terrible employee. Seriously, when someone asks you the details of a linked list, they're not trying to find out if you will be able to use one specifically on the job. They're tryin…
linked list is not complex for christ sake.
Re: The Programming Interview from Hell
#23Re: The Programming Interview from Hell
#24OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
Re: The Programming Interview from Hell
#25OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
The standard data structure to look for in this case is the disjoint-set data structure (also called union-find), https://en.wikipedia.org/wiki/Disjoint-set_data_structure . That should make your function fairly easy to implement.
Re: The Programming Interview from Hell
#26OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
Re: The Programming Interview from Hell
#27OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
Re: The Programming Interview from Hell
#28OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
For i from 0 to n-1 , find all sets from i+1 to n-1 which have a non empty intersection with set i. Union set i with all those sets and replace i with the union set.
If you use a disjoint set data structure this will be quadratic or O(n^2)
EDIT: On further thought you need to merge from the end and backwards.
Re: The Programming Interview from Hell
#29Anything less than tossing the playbook warrants a gentle suggestion that we shouldn't waste any more time here and why don't we just end the interview. Stand up, shake hands, thank them for their time, and walk out.
Problems in the interview process should be seen as problems with company culture. I used to wonder about how to appropriately answer the question, "which companies are worth working for?" because it seems like you need a lot of time before you can really tell. But once I realized that the interview is just an extension of company culture, it got a lot easier to weigh opportunities.
I mean, obviously, if you need the money you need the money, but developers are hot enough commodities that it doesn't take long before you're entrenched enough to be able to call the shots like that.
Re: The Programming Interview from Hell
#30OK - but here's a genuine problem that came up the other day in my work (reconciling two datasets - we have various many-to-one mappings of ids that we then want to reconcile against each other). I think it's quite a neat computer science/algorithm challenge, so here goes: Write a function which takes as input a list of sets, many of which are not disjoint, but will output a list of sets where all of the non-disjoint…
Your two examples have the same inputs but different outputs if I am reading this right. What did I miss?