Hacker News new | ask | show | jobs
by jrjarrett 1001 days ago
You have to do leetcode if you want any hope of being able to find a different job. You have to be ready for that kind of question.

I’m a software engineer with 20+ years of experience in a bunch of different industries. I know what I’m doing.

I did 3 interviews with 3 different companies in the past couple months and utterly failed at the leetcode style coding interviews. The last one was to “print out the contents of a binary tree, each level on its own line.”

I had 1/2 hour to do it. Oh, and I had to translate their sample seed code from Python to Java, since I’m stronger in Java.

I haven’t seen a raw binary tree in 20+ years. I at least remembered how to depth first traverse it, but haven’t seen in order traversal since my freshman year of college.

So look-I was able to read and translate Python, a language I don’t use to one I do, and pull out of deep storage how to traverse a binary tree one way, but since I couldn’t remember the other ways, I failed.

My daily job is far more about translating complex business requirements into appropriate data stores, improving performance, working with cloud providers - NOT banging out freshman level programming tasks. I’m out of practice for that.

So to be in a position to change jobs, you sadly have to spend time keeping that information freshened.

It’s not helpful to leetcode grind; I’d rather spend the time and energy I have for non-work coding to learn a net-new language. It’s not the “hive mind saying we should”.

It’s the stark reality of the hiring processes everyone has decided is necessary because there’s a myth that no one applying for a software development job can code and if you don’t do these kinds of interviews (and don’t screen any other way) you’ll hire these fakes.

4 comments

I think it has helped me to do five to ten hours of refresher on elementary data structures and algorithms in the week or so leading up to interviewing at places like Google and Stripe.

But I really hate hearing that people are sinking hours and hours into doing tons of these problems, and on an ongoing basis. What a horrible waste of human life.

> You have to do leetcode if you want any hope of being able to find a different job.

It's funny how much perspective can differ between people. I have 15 years and was asked to do leetcode type of question twice, both times I was interviewed by person with significantly less experience.

I was also on the other side of hiring table and was never, not even once, asking people to do leetcode stuff during interview. I had way more practical approach which was giving me all signals I needed.

Having said all of this, my hobby is codingame and I enjoy competetive programming myself, it's pure fun and I enjoy it a lot.

> You have to do leetcode if you want any hope of being able to find a different job. You have to be ready for that kind of question.

I disagree with that statement. You don't have to do leetcode, though it can be helpful if they have leetcode-style problems to get timed practice (not everyone is good at the 30-minute challenge under pressure; for some reason my general test anxiety, which interviews can bring out, doesn't apply to code tasks).

Learning and maintaining the fundamentals is sufficient (again, modulo the benefit of timed practice). Even for your problem, there are only three places that an action can be applied to a node when traversing a binary tree: before traversing the children, between traversing the children, and after traversing the children. The traversal code is otherwise the same (this also applies generally to any tree structure, it's not just a binary tree thing though "in-order" is ambiguous when you have more than two child nodes).

  def traverse(node):
    if not node: return # alternatively, this test can be applied to left/right before the recursive calls but requires also testing before the initial call
    # pre-order
    traverse(node.left)
    # in-order
    traverse(node.right)
    # post-order
I've named them here, but those are the three positions you can put a print statement. Even if you don't have the time to work out which one is which, you only have three things to try. An important aspect of focusing on the fundamentals is recognizing why this traversal code is the same regardless of where the action will be placed: You're traversing a recursive data structure (`Node = None | (data: T, left: Node, right: Node)`), that in itself determines the fundamental recursive structure of the traversal code. This same approach can work with any recursive data type which mitigates the need to memorize any particular algorithm on specific recursive data types.
You still need to practice, you won't be getting easy questions like that all the time. There are tricks you need to know to solve many others.
> I at least remembered how to depth first traverse it, but haven’t seen in order traversal since my freshman year of college.

Well, to be fair an in-order traversal is not what you needed to solve that problem...an in-order traversal would get you the elements of the tree sorted, irrespective of level. This is not a "gotcha" problem where you either know it or you don't, it's about using a basic data structure in kind if a weird way.