Live data from Hacker News

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

dewitters.com

131–140 of 409 posts

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

#131

Earlier quoted context omitted.

Wow those sound like such badly designed questions. What country is this?

I don't know about that person, but a friend of mine from India was telling me about a driving test question there - [translated] "How far should you stay behind another car - A) 2 meters B) 2 seconds". Apparently the correct answer is 2 seconds. In my opinion, the question is weirdly ambiguous.

What's ambiguous about it? Two meters behind a car at highway speeds can get you killed.

If it were a question only about cars at rest it would be phrased something like "how far behind a car should you stop when queued" or something of that nature.

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

#132

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…

Can you link the textbook? I'd be interested in reading it.

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

#133

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…

Interestingly, you can use scheduling to make a non-amortized dynamic array. Your probably know this, but for other commenters who do not—

Keep two arrays, of size n and 2n. Initially the first has capacity c = n/2 and the second has capacity 0. Reads go to the first array. When you append, append one element to the first array, and copy two elements to the second array. By the time the first array is full, it has been entirely copied to the second array—so discard the first array, move the second array to be first, and allocate a new "next" array.

The same trick can be applied to many amortized data structures (but it gets very complicated when you have many operations).

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

#134

I was once in this position, but decided to continue through with the "right" answer anyway. Even though the interviewer was adamant that he was right (as, of course, was I), we briefly stopped the interview and made some Google searches to get to the truth. I could ostensibly argue that I got the job not by telling the interviewer what he wanted to hear, but by doubling down on the right answer and showing that I ha…

I’ve seen people go through the pipeline with “no hires” from interviewers because of small differences of opinion. In your case, I’d wager that the disagreeing interviewers feedback may have just been discarded.

They didn't fully clarify what kind of feedback the interviewer likely ended up giving in the end, though. I'd be curious to know if after they Googled it the interviewer acknowledged he was wrong and the interviewee was right. (I think they're kind of implying that, but it's unclear.)

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

#135
The questions in this story seem like basic filtering questions, since the amount of signal one could derive from their answers is essentially perfunctory. Why is basic filtering being done in a multi-party in-person interview? That seems like a waste of everybody's time. Especially that of the company doing the hiring.

A whole separate matter is the use of what amounts to a technical glossary being used as an evaluation criteria.

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

#136

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…

In some cases amortized isn't good enough though, and games could certainly be one of them!

(Anywhere you're servicing some kind of interactive request might qualify, depending on this size of your datastructures.)

This is actually something I like to work through in interviews:

OK, you've got amortized-constant-time append to your array-backed colletion, but now what if we need it to be really constant time? How could we achieve this? (Same question & trick applies to hashtables.)

(The answer can be found, amongst other places, in the Go or redis source code.)

edit: or in pavpanchekha's comment, they beat me to it :-)

also, just realized you're the author of crafting interpreters. absolutely love that book!

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

#137
post #129

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…

Just a thought -- gaming is latency sensitive. Maybe their issue with it wasn't about average performance, but that the once-in-a-while perf hit would be enough to cause a bad experience for the person playing the game? I know I'd be frustrated if there was a predictable lag spike while playing a game.

Any game engine design worth its salt would:

1. Probably not used linked lists (contiguous layout means better cache efficiency)

2. Would try to understand their data requirements and allocate memory up front as much as possible - doing a similar amortized analysis the OP is suggesting rather than a generic "always have O(1) insertion" at the cost of using an inferior data structure (a linked list)

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

#138

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…

You wrote a book about std::vector?

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

#139
That's the one thing I hate about web (backend) development in languages like java, c# and so on

There's GIAAAAANT focus on patterns, architecture, patterns once again

and even more talk/discussions about it, yet even people with years of experience get stuff wrong.

I feel like systems programming is simpler in that matter.

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

#140

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…

Can you link the textbook? I'd be interested in reading it.

I talk about dynamic arrays in Crafting Interpreters:

http://craftinginterpreters.com/chunks-of-bytecode.html#a-dy...

Post reply on HN