The Programming Interview from Hell
31–40 of 147 posts
Re: The Programming Interview from Hell
#32OK - 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 complexity of this data structure is pretty interesting. It basically comes to O(N) for N How to solve this on a distributed system I have no idea.
[1] https://en.wikipedia.org/wiki/Disjoint-set_data_structure
Re: The Programming Interview from Hell
#33OK - 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…
You could model the problem as a graph (each integer represents a vertex and two consecutive integers an edge, e.g. (1, 2, 3) is a graph with nodes 1,2,3 and edges between 1 and 2 and 2 and 3). Then your problem is just to find all connected components of the graph ( https://en.wikipedia.org/wiki/Connected_component_(graph_the... .
Re: The Programming Interview from Hell
#34I once had to use a linked list to implement a sorting algorithm on a huge but partially sorted input. This was to detect duplications in an AST, for a static code analysis startup. This was literally the only time I professionally used any sort of non-trivial data structures and algorithms, and I've been working in the field for some 10 years now.
Re: The Programming Interview from Hell
#35Re: The Programming Interview from Hell
#36I 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.
[0]: https://github.com/buserror/rf_bridge/blob/master/src/rf_bri...
Re: The Programming Interview from Hell
#37I was ushered in. The Guy with Two PhDs (he showed me his business card first, and there were indeed two PhDs on it) asked me:
"What is the simplest way to synchronize two threads?"
I rattled off some synchronization primitives. Semaphore. Critical section. I was ready to do an implementation if he wanted.
"No, the simplest."
I dug around. Interlocked operations? A mutex? A spinlock? I mentioned Dekker's algorithm (it sucks, but it's simple). I dredged up a few more.
"No, I want the SIMPLEST possible way to synchronize two threads. What is it?"
I'd run out. He gave a disgusted snort. The next question wasn't much better: "What's the BEST way to share data between programs?"
"Not sure what you mean by best. How many programs? Is it over the network? Hmm, shared memory and a maybe a signal of some kind?"
"No, the best way!"
This interview did not go well. At the end, Dr. DoublePhd scolded me for dropping out of college and told me to go back to school to finish my degree.
That evening I wrote the hiring manager that Dr. DoublePhd appeared to want the answer "raise interrupt priority" for the thread synchronization question -- which doesn't work on a multiprocessor -- and that I had no idea what the heck he was asking for on the other questions.
I didn't add that even the awful questions I was being asked could have been productive interview fodder in the hands of a good interviewer, but that in the hands of a terrible person they were destroying that company's ability to hire.
Turns out that I didn't need to add that last bit. A few months later the hiring manager emailed me, saying that they had fired Dr. DoublePhd and would I consider interviewing again? I politely declined.
I never found out the BEST way to share data between programs. In fact, I'm still looking. I think we all are.
Re: The Programming Interview from Hell
#38I 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.
There are many people for whom this is complex, you're assuming a foundation that not everyone has. There are also many people for whom nothing is complex, they assume they can understand everything, while they don't currently, they assume they'll be able to learn it without issue.
Dealing with new starts who are straight out of education is often like reading posts from 4chan.org/b, at first you don't know if they're joking.
It's not all doom and gloom, occasional I'm pleasantly surprised by the calibre of those beginning their career/hobby, but this is the exception.
Re: The Programming Interview from Hell
#39I 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.
I agree, its not that hard, but that's all the more reason to avoid giving attitude about the question. Answer it quickly and move on. If you can't answer it quickly, maybe it _is_ that complex.
A lot of interviewers have a short time window in which to conduct their 1-on-1. Sometimes they ask easy questions for a reason.
Often, I start with a soft ball that I intend on building on - turn a linked list into a doubly linked list; a circular list; can you improve the lookup time; can you make it generic; what are the space constraints; what are the time constraints.
And if they can't answer the simple question, we just leave it at that.
A simple question can easily be built upon. "I'd Google it" can not.
Re: The Programming Interview from Hell
#40i recently had an interview which was plain smart what i need to get my work done questions i loved it ( i took that offer ). but then there were few where they did ask me a question on solution implementation and when i solve it they said there is a better way to do this and then I would be like ok then let's discuss but then they were quiet on the other side and waiting to hear me answer the best possible way to so…
This is his writing style, which I believe would complement yours quite nicely: https://www.reddit.com/user/commahorror