3 ms·
I really feel for your personal situation, and I appreciate your candor here. Unfortunately, I come from the school of thought often derided hereabouts that th
by mercutio2 10y ago
I really feel for your personal situation, and I appreciate your candor here.
Unfortunately, I come from the school of thought often derided hereabouts that this is an excellent interview question, and your unwillingness to engage with the question would've gotten you a bad score for that interview.
Generally speaking I think it's great to start with:
A) I don't know a great solution to that! Would you like me to brute force it? If I, the interviewer, am looking for brute force I'll say yes, code it up, but if not I'll say no, imagine we've already brute forced it and now we've found we need to optimize
B) I won't care if you actually figure out the precise closed form gotcha answer, but I'll want you to engage seriously. It's a test of whether you can discuss and identify patterns in a coherent way when working with a colleague, which is probably the most important signal for me, second only to "will this person get things done in a normal 40 hour work week"
It's entirely possible the interviewer was just a jerk, and wouldn't engage with you, and I feel bad for people who freeze in high pressure interview situations. But at first blush, your response sounds like you wouldn't engage with the problem at hand, and that just isn't the way to go in an interview, if at all possible.
- p4wnc6 10y agoI did A) and gave the for-loop algorithm that examines each integer in the range on one axis, computes the value of the line at that point, and checks if it's also an integer. The interviewer said this works, asked me the time complexity (trivially O(N), where N is the number of integers in the range on that axis), and seemed happy. Then he asked if I knew a way to do it using the GCD. I said I did not know off the top of my head, and then he concluded the interview and left no time for me to ask questions. I think your characterization that I "didn't engage" is not right. The interviewer was also clearly not looking for someone who needed paper and pencil to work out this property, but instead specifically for someone who "just knew" it as an immediate trivia fact. FWIW, I don't agree this is a good question. It's so-so, and it's fine if the goal is to work through it, but that was not at all the case. I should also add that I consider myself reasonably good at dumb-shit tricky interview questions. I've done well in stereotypical finance interviews asking riddles, card shuffling tricks, colored balls in urns, drunk man sitting in the wrong airplane seat, etc., as well as more formal probability questions. This simply just came down to me not making an instantaneous connection between the number of integer lattice steps between the end points and the GCD of the ranges. I don't think it's the same as freezing, it's just that that knowledge would never have been accessed in the particular interview setting. It's just not how I think about that problem, and never would have been. I'm certain you could devise endless algorithm trivia just the same. Print a binary tree in some weird order, rotate a 3D data array, etc. The one and only way I'd ever solve anything at all like that is slowly and by drawing lots of pictures, making some candidate code, putting it into an interactive programming environment with small toy examples, and iterating. And in all my professional experiences, including a high-intensity quant finance job, that has been more than good enough for any job-related problem, and has also been what everyone else did. Only in interviews have I ever encountered anything like this.
- mercutio2 10y agoThanks for your response. Given your clarification (alternately, perhaps I misunderstood your original post) I retract my criticism. If you drew a picture and engaged, and he actively wanted a closed form and didn't want to see you work it out slowly, then that's a poor interviewer, not on you at all! I will note that I do occasionally ask "do you happen to know if there's a closed form" for things, as an extra credit kind of thing, making clear I'm curious and I don't expect a yes. Someone could easily get the impression this is a high stakes question if I wasn't clear it's not; conceivably that was the intent in this situation. But any which way, sounds frustrating and the interviewer was either a jerk or unclear.