Live data from Hacker News

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

dewitters.com

211–220 of 409 posts

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

#211
post #79
post #15

Can't really comment on whether that was the correct way to handle the situation, given that passing the interview was the goal. However, I would have a hard time giving an incorrect answer on purpose. I also consider an interview as an opportunity to learn about the company I'm going to work for, and especially my future colleagues. I would probably try to give a full answer, such as "there's a widely-held concept X…

The more time I've spent in tech, the more I realize that there are very few "correct answers" - there are things that work in a particular context. Software patterns in particular are just what you make of them. I would have no problem saying "many people use MVC to mean 3 tier and other people use it to mean XYZ". It is very difficult to be completely technically correct. It is also rare that one needs to be comple…

Also each person has an unique model in their head. Even if you read the same material, you could interpret it differently and people learn in different ways.

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

#212

Earlier quoted context omitted.

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...

Thank you for giving away your book for free. I signed up for the mailing list and hope to purchase a copy when you're releasing printed versions.

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

#213

I was in a job interview several years ago and I was given the following prompt: "You have a database containing locations with their corresponding latitudes and longitudes. We want to be able to input an arbitrary latitude and longitude and have the program return all locations within a radius from that point from the database." My initial reaction was to say "I would use a GIS library/API", but the interviewer want…

Some times "good enough for jazz" applies I solved a similar problem - find all geo locations within 2 hours driving time of x,y

I basically used the great circle distance (using I think a CPAN module) as an approximation - this was for geotargeting AdWords.

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

#214
Have to say that the interview was handled masterfully. However, regarding the technical premise of the discussion. I agree that the model & view are in the middle layer, but isn't the view in the view layer? It's whole purpose is to package it up for display which includes haveing the graphical elements rendered.

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

#215

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 had a less dramatic one where someone argued with me that the lookup time on a binary tree was O(H), the height of the tree, not O(log2n). I was so baffled by the argument that I didn't realize until after the interview that I should have pointed out that the height of a binary tree is log2n.

They were technically correct. The lookup time on a binary search tree is O(H), which is equal to O(log2n) if the tree is balanced. Tree data structures invest a lot of complexity into keeping the tree balanced.

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

#216

Earlier quoted context omitted.

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 be…

This is dangerous, but if well documented and understood it might be okay. Some data might contain unique things (for argument's sake, say a std::unique_ptr). It can get tricky since you need to know the implementation details of everything that gets inserted and it's ownership behavior, since elements can be kept at two places. (A copy in array n and one in 2n.) Then there is the fact that you basically make every i…

> Then there is the fact that you basically make every insertion 3x as costly. You better have a good reason to need this given the additional complexity and caveats.

> As for the original interview question, there are systems where an occasional longer pause is not OK.

As you say, it's a tradeoff between worst-case operation cost and average operation cost: If you allow any worst-case operation cost, you can get really efficient on average. If you want really efficient worst-case operation cost, you can't get it down to exactly the average operation cost you could've otherwise gotten.

I wouldn't be surprised if this tradeoff is inherent to many de-amortization problems. But since the difference between the amortized and de-amortized solution is usually only a constant factor (as it is in this case), you have to be very specific about the model of computation if you want to prove anything mathematically.

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

#218
I've found that these situations are actually quite useful from my side as a prospective employee. If the interviewers are treating this as a "gotcha" interview and it turns into a test instead of a discussion, then that's a pretty good sign that this job is not going to be a good fit for me. The best jobs I've had are where the interviewers treated me as a potential future colleague, and the technical questions were more of a starting point for a detailed discussion of different scenarios rather than a straight quiz.

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

#219
post #205

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…

There was a meme going around where a doctor took a high school biology quiz. Q: What are mitochondria? A: [Long complex scientific answer about ATP synthesis] Grader: Wrong. Mitochondria are the powerhouse of the cell.

In a "Business and Communication Systems" exam at school I got the question "Explain how email works". Being the nerdy teen I was, I wrote about SMTP, MX records and that sort of thing.

That was not the right answer.

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

#220

Earlier quoted context omitted.

log(n) is ok. Sublinear with respect to n is also ok. "Sublinear" on its own is not, at least if my understanding is correct (sublinear relative to what?), although I can see that it can be a common shortcut to make.

All the necessary information to answer your question is in the original comment. They're talking about computing the nth Fibonacci number and say that the matrix exponentiation version is O(log(n)). Unless you think they're using n to represent two (potentially) different things, there is little room for confusion. "sublinear" refers back to that O(log(n)) algorithm.

They are representing n to mean 2 different things. In this case, n is meant to represent a value passed in to the algorithm. The problem is that complexity is usually expressed relative to size of the input, which in case of this algorithm is log(n) = m bits. This makes the exponentiation version actually linear in terms of bits needed to represent the input.

It's like saying that an algorithm that accepts n x n matrix and takes O(n) steps to compute something is "linear" - it's not linear, because the size of the data is m = n^2, which makes it O(sqrt(m)).

Post reply on HN