Live data from Hacker News

I had to give a wrong answer to get the job (2017)

dewitters.com

311–320 of 409 posts

Re: I had to give a wrong answer to get the job (2017)

#311

Earlier quoted context omitted.

If I remember correctly, that question likely refers to some argument in the driving manual about speeding. Something along the lines of "speeding in most urban areas doesn't actually help get someone to their destination faster. There are always multiple traffic lights and other cars to contend with, so it's not helpful to go over the speed limit and it increases the risk and severity of an accident." It's perfectly…

it isn't true though. suppose there are n lanes and more than n cars, which is almost always the case in the city. if you pass someone, even just to end up stopped at the same light, you are still ahead of them in line. moving ahead by one slot is a very marginal gain, but it does add up if you pass many cars on your journey. in addition to being ahead by however many slots, eventually you will encounter step-wise ju…

>the way to discourage people from speeding is not to tell them something obviously wrong, but to discuss the legal/safety risks and the increased gas and brake pad consumption.

Is it though? Almost all the knowledge we have is taught using flawed and simplified models that we can niptick and find "obviously wrong" when deeply examined. https://en.wikipedia.org/wiki/Wittgenstein%27s_ladder

And IME, when I'm explaining something, pedantry and specifics almost always get my audience confused more than help to get the point across.

Re: I had to give a wrong answer to get the job (2017)

#312
post #45

In my experience, being "right" is no bar to getting the job. In one case where I was going for a C++ expert job, I got asked a question (that I can't remember now), gave the correct answer, which the interviewer disputed. I asked if they had a copy of TC++PL on hand, which they did, and I pointed out the relevant section. I got the job. In another case, I was asked something complicated about "const" in C++ (which h…

This behavior selects for good, or at least compatible, coworkers. Of course if you are desperate for a job then you should read the room and say whatever they want to hear, but if the job market for your skill set is strong, you should show your personality and be open about how you approach technical problems (unless you're really an over-the-top asshole, and nobody thinks that about themselves, so it's pointless to give advice for that situation.)

Once in a technical interview I was asked what data structure I would use for certain functionality "if performance was really critical." I said it would depend on the size and structure of the data that we needed to support, and when the interviewer said "unbounded," I said that the answer to that would go beyond an in-memory data structure, and if performance is critical you need to be able to project the sizes of data you need to support in the near future.

I could tell the interviewer thought my answer was ignorant and sloppy. He started giving me a few "hints," which showed that what he wanted was the data structure had the best big-O performance. So I told what the best big-O performance was for the problem and what common data structure would provide it.

Then he said, "So you would use that?" wanting to put the question to rest and move on the the next one, and I could have said yes. But instead I said "maybe," and I told him I remembered Bjarne Stroustrup talking about how algorithms classes in computer science education give students the wrong idea about how software engineers choose data structures and algorithms in practice. The university version, he said, is that if performance isn't critical, you just pick a container with the right functionality, and then if it turns out that performance matters, you pick something with the best possible big-O characteristics to get ideal performance.

In reality (according to Stroustrup), when performance isn't critical, you should pick something with good big-O performance, and if it turns out that performance matters, you measure on realistic hardware with the data sizes and characteristics you need to support, and in many practical performance-critical cases you will end up choosing something with theoretically suboptimal big-O performance.

I told the interviewer I liked Stroustrup's approach, and I always used data structures with known good performance by default, but I would measure if it mattered. I didn't get the job, and that was probably for the best at that stage in my career. I've nevertheless ended up working in situations like that, where people living by ideas I knew well thought I was an idiot for not understanding them, when I really just didn't completely agree with them, and those situations did not end well.

Re: I had to give a wrong answer to get the job (2017)

#313
When we first designed Django we decided to describe it as a MTV - Model Template View - framework because we thought that the classic "controller" concept from GUI applications didn't really apply to server-side web applications.

Rails took a different path: they called their Ruby application code the "controller" and their template files the "view".

With the benefit of hindsight, I'm not at all confident we made the right choice.

I still think we were right from a pedantic point of view, but having to spend over a decade constantly explaining that "no, in Django the view layer is a different thing from the template layer" doesn't feel to me like it added much value for all of the extra effort!

Re: I had to give a wrong answer to get the job (2017)

#314

Earlier quoted context omitted.

> None of the comments above yours in the thread mention any form of the word "fast" or "speed". They mention "performance" in reference to big-O complexity. Big-O is not always about speed. I am sorry, do you want to say "performance" and "big-O" have nothing to with trying to make the program go faster? I think you have lost your way and need to backtrack a little bit. The whole point of big-O analysis is to be abl…

If I ask for something to be done in O(1) I'm not asking for it to be fast, I'm asking for it to take the exact same amount of time every time no matter what. That might end up being slower, but so what, maybe that's what I need. If I ask for an O(1) algorithm and you build something that is as fast as possible, faster in every case, but sometimes it's really fast and sometimes it's a little less fast but still fast…

I'm confused - that isn't what I understand O(1) to mean. To me, O(1) means only that there exists some constant that bounds the runtime, while individual invocations can absolutely be sometimes faster.

Re: I had to give a wrong answer to get the job (2017)

#315
post #259

Earlier quoted context omitted.

I bet they weren’t as dumb as you think and you were passed on for being stubborn and drunk on ego. Of the many scenarios where amortized complexity is not okay, code in a tight loop where predictable performance is key, e.g. code running game logic, jumps immediately to the top of the list. The fact that you were unable to incorporate this into the conversation makes me suspect you were more interested in putting on…

Unfortunately, you are wrong. Arrays used as backing for lists are faster than linked list in almost all cases, assuming they are implemented correctly (as is the case in Java, which I bring as an example). Linked lists have a lot of huge downsides that are not easily captured in their naive big-O characterization. Big-O does not tell anything about how efficient things are. Two algorithms can have same big-O complex…

Linked lists are better for immutable/persistent structures

Re: I had to give a wrong answer to get the job (2017)

#316

Earlier quoted context omitted.

Unfortunately, you are wrong. Arrays used as backing for lists are faster than linked list in almost all cases, assuming they are implemented correctly (as is the case in Java, which I bring as an example). Linked lists have a lot of huge downsides that are not easily captured in their naive big-O characterization. Big-O does not tell anything about how efficient things are. Two algorithms can have same big-O complex…

Linked lists are better for immutable/persistent structures

If your data structure is immutable, then an array is always faster than a linked list.

Re: I had to give a wrong answer to get the job (2017)

#318

I bombed an interview at a game company because I gave a right answer that I couldn't get them to understand. I don't remember the exact problem they wanted me to solve, but the answer involved a dynamic collection and they wanted it to grow with constant time complexity. They were probably looking for a linked list. But I said I'd use a dynamic array because those have constant time when averaged over a series of ap…

I see a lot of responses defending the interviewers, or saying what you should have done.

Maybe so, but I'm just gonna go ahead and say - those interviewers were shit. Most interviewers are, so it's not really a judgement on them, but the problem in that room wasn't you.

Re: I had to give a wrong answer to get the job (2017)

#319
post #259

Earlier quoted context omitted.

I bet they weren’t as dumb as you think and you were passed on for being stubborn and drunk on ego. Of the many scenarios where amortized complexity is not okay, code in a tight loop where predictable performance is key, e.g. code running game logic, jumps immediately to the top of the list. The fact that you were unable to incorporate this into the conversation makes me suspect you were more interested in putting on…

> for being stubborn and drunk on ego. I think you would have a hard time finding someone who knows me describe me that way. Maybe the way I related the anecdote here doesn't present me well. I am pretty meek and easily flustered. I don't think I was any more confident back then than I am now which is, alas, not very. > The fact that you were unable to incorporate this into the conversation In this case, it was an in…

You may be entirely correct in your analysis. There are definitely a fair share of toxic interview setups and interviewers out there. What I found off putting about the way you presented the story was the bit at the end where you gloated about your current employment status and achievements as if they missed out on some great mind. It gives the impression that in your view, your intellectual prowess was more important than being a good candidate and potential teammate. While that of course may just be the way it came off, that was my perception. So it drove me to present the alternate, less charitable, interpretation where the interviewers did in fact understand amortized complexity and simply didn't find it suitable.

> I would have been happy to have a more productive discussion about which problems amortized analysis was the right fit for.

This is the type of conversation I tend to enjoy during interview problem solving because IMO it most accurately reflects the type of conversation you'd actually have with teammates when building a system. I also might try to bait this topic by specifying O(1) worst case insertion up front and watch for how the candidate interprets the requirement, what type of questions are asked, etc. If you started implementing an array backed thing I might stop you early and prompt the insertion analysis specifically. However, in my experience people tend to discuss an overview of the solution before writing any code which is a great point to iron out any clear non-starters or missing requirements.

> Overall, they had a superior tone that I found off-putting.

Fair. It's a two way street after all. Even if they were entirely fine and it was all a comms misunderstanding, sometimes personalities just don't gel. Glad you found success the next day!

Re: I had to give a wrong answer to get the job (2017)

#320

Earlier quoted context omitted.

If I ask for something to be done in O(1) I'm not asking for it to be fast, I'm asking for it to take the exact same amount of time every time no matter what. That might end up being slower, but so what, maybe that's what I need. If I ask for an O(1) algorithm and you build something that is as fast as possible, faster in every case, but sometimes it's really fast and sometimes it's a little less fast but still fast…

I'm confused - that isn't what I understand O(1) to mean. To me, O(1) means only that there exists some constant that bounds the runtime, while individual invocations can absolutely be sometimes faster.

Well, not exactly.

What it really means is that the execution time does not depend on the size of input (n).

What it does not say is how much time it takes to execute, whether it is exactly same amount of time every time or whether there exists some kind of upper bound on execution time.

For example, an algorithm that takes 1/(randFloat()) time to insert an element to the data structure where randFloat() returns any possible floating point number with equal distribution, is still O(1) algorithm, even though there is no upper limit on how long it can take to execute.

Post reply on HN