Hacker News new | ask | show | jobs
by lmarcos 1156 days ago
But even if the job actually requires solving puzzles like that one, what's the point of asking the candidate to solve it in 45 min? Without googling? That's what it's actually totally unrealistic.

Give me any problem related to algorithms+ds to be solved in 45mins without internet access and someone looking over my shoulder and I will give you a poor solution. But give me a day and internet connection and I will solve the problem in the most efficient/readable/maintainable way possible.

2 comments

It's especially ironic that this puzzle structure selects away from candidates whose ordinary method would be to look up available algorithms, rather than just going with the best answer they came up with off the top of their head.
That actually explains a lot of Google.
To be honest the first solution is literally one line of code. The data structures are those included in Python, there's nothing to look up. It's an important skill to take some code written by others and understand precisely it's performance characteristics.

The interview question is not just about knowing data structures and is not about Behdad showing off either. It's the starting point for a Socratic discussion.

> To be honest the first solution is literally one line of code.

OK, but every program is literally one line of code. We only put line breaks in to make them easier to read.

The author makes this terrible comment about his "one-liner":

> Most candidates though write a for loop, which is equally acceptable.

He has also written a for loop. Specifically, he's written this for loop:

    for i in range(1, len(s)):
        if inDict(s[:i]) and inDict(s[i:]):
            return True
    return False
Yeah, that's the part that tripped me up. Looking down on for-loops immediately after showcasing their for-loop solution!