wk48 best question:

My go to question for dev interviews is how do you find all prime numbers from 2 to x because there's so much room for optimisation.

Start with the basics, loop over every number and check if it's divisible by any number less than it, then record the prime numbers and check only those, then move to something like the sieve of eratosthenes then reduce the problem space and only iterate through 2 to sqrt(x)

  • 0
    Definitely gonna lookup prime number optimization before an interview.
  • 1
    I just gotta ask, why is this important in an interview? Do you run the same question to a jr and senior?

    I understand some mapping of knowledge is required, but honestly - that can become real obvious just talking to a person asking him to talk about technology and solutions. I've never experienced these challenge interviews, but they seem to distract the interviewee from what really matters.
  • 1
    What really matters in a hire regardless of the level is "can they code worth shit" and "can they learn new shit".

    Sure, they know a programming language but if they solve a problem in factorial time and wonder why it takes ages to run then they're no use to us. If they can't explain how they would solve the problem, or worse, can't solve it, they're no fucking use to us at all.

    This question gives a candidate opportunity to demonstrate their problem solving skills and their programming skills (write pseudo code, what data structures would you use, how would you test, can you think of a way to make it faster). It also tests their communication and understanding of new concepts (tell us how you might make it faster, we explain sieve, they discuss and implement)

    But you're right, this is probably more of a junior question but I'd still want to see a senior write some form of code in an interview. 2 reasons:
    Make sure they're not bullshitting their CV and make sure they write good code
  • 0
    Also "talking to a person" does not permit gradable criteria. this question has a tangible difference between "does well" and "does not get it". Without gradable criteria there is a massive scope for bias, "I like this guy lets hire him whoops he can't code oh bugger. Stuck with him"
  • 0
    And no, you're right this is more of a junior question, it requires very little domain knowledge as we explain what the sieve of eratosthenes is and ask them to discuss how it can be optimised.

    When recruiting for a more senior role we would use questions that assess aspects of domain knowledge they should have. But again, same questions to everyone so there can be a fair comparison of quality.
Add Comment