4

I'm a front-end developer with two years of experience. I write a ton of JavaScript and React in my job, and I consider myself a competent developer.

I recently started a data structures and algorithms course, and got around to the leetcode portion today. I tried the two easiest array questions, and I struggled mightily. Questions that were marked easy I tried to solve for an hour or two. I couldn't solve either of them, and had to look up the answer.

I eventually understood the answers, but I realized that I would not have come to them on my own. I could have tried the problems for the entire day but would not have settled on the solution.

I'm confused about how one gets better at interview questions. Will reasoning through the questions, failing, reasoning through the answer, etc. eventually help me come to these solutions on my own? Are there patterns that one learns eventually that one can apply to various interview questions? It feels like every interview question I'm encountering is this "blue-sky general problem" that I've never encountered before, and I struggle to see how I can apply that solution to other problems. It is so different from practical programming and I struggle with it immensely.

I've built out scalable, data-driven apps from scratch, always seeming to come to the solution. I feel like I'm missing something regarding how to succeed at interview questions. This is the third time I've attempted to grind leetcode, and each time it feels like I'm not a very good programmer, because I can't solve these questions. I want to change my job, but I fear I will never come to interview question proficiency, and it causes me great anxiety.

Any words of advice would be appreciated, thank you.

1
  • 2
    It seems like you're asking, "will practice make me better a something?" The answer is obvious, YES, it will help. So if your goal is to get better at solving "Leetcode style question" then by all means do it. Will that make you a better software developer? Probably not. Will it help you get a job? Maybe, since many companies now use these sorts of artificial programming tests as a screening tool, then it may help. But you will still almost certainly face real people who will want to understand what you really know.
    – jwh20
    Commented Sep 24, 2021 at 12:58

6 Answers 6

5

I'm confused about how one gets better at interview questions. Will reasoning through the questions, failing, reasoning through the answer, etc. eventually help me come to these solutions on my own? Are there patterns that one learns eventually that one can apply to various interview questions?

Yes. At least, for Medium / Easy leetcode problems, there are general patterns, and studying them a large amount will let you see them.

There are a few different schools of thought on this. When interviewing, the interviewers rarely need you to come to the correct solution by yourself - much more important is having a solid thought process that you can explain, as others have said.

With that said, having the answer won't hurt you. If you have the time to study leetcode a bunch (and actually study - do the problems, don't just look at questions and then look at the answers), you will start to know all the types of problems that appear, and they will get easier.

Some may think of this as cheating - as like, gaming the system, getting good at a part of the equation that you're not supposed to. The idea of an interview is you are given a decently easy question that you haven't seen before, and you solve it out loud. If you've seen all the types of questions before and can remember a solution by rote, then... you aren't playing to that system. So be aware of that, and if that happens, still walk out through a reasonable thought process.

Whether this is a good idea or not, that's up to you. I personally studied leetcode some, but not a lot, prefering to do mock interviews and practice solving questions out loud. But at the same time, algorithms was not a pain point for me. For some of my friends, they studied leetcode 10 hours a week for a few months, and got good results - mainly, I think, you boost your confidence and ability to work through such problems in general. But knowing the specific types of problems and just being prepared does not hurt either.

One last note - I said in the first question that it applies to Easy/Medium questions. If, in an interview, you're given a question that is of the leetcode Hard category, then you aren't generally expected to be able to solve it without a lot of thought - and, likely, back-and-forth with the interviewer. The point may even be to not have you be able to solve it, and see how you handle it.

Whatever the case, the general patterns which cover leetcode Easy and Medium categories also cover interview questions of those difficulties, and can be learned. Hard questions are much more wildcards, and if you choose to include them in your studying, be aware of that - and don't expect to ever be able to solve them without a real time investment.

1

While experience does count, you might be too focused on the actual question.

Employers use technical interview questions for a variety of reasons. A simple one is to quickly weed out the below-par developers. When this has been accomplished, actually solving the problems posed by the questions becomes less important; it's your thought process, work ethic, discipline and perhaps even personality that's on display.

If you fail the simple questions - then the job was never yours. Because the more involved questions seek to uncover how you already work, it could be argued that they need no preparation or cannot be prepared for; just be diligent in your every day work and carry that into the interview.

1

Most of the time, the interviewer is looking for how you would solve the problem not necessarily the answer. Senior developers are aware that their way of solving a problem may not be understandable to everyone. If you're asked how you would debug a solution and your answer is "look through the logs" that shows you have solid understanding of fundamentals. If they ask, how to debug an error specific to a language, then you should know a good amount of detail about that language.

1

Will I get better at programming interview questions if I keep doing them, or will each new problem feel like something I've never encountered before?

Most people get better at anything by practicing. Certainly that is the case for me and everyone I know - the more interviews, the easier it became.

You will clearly find some different questions at each interview, but the process of taking your time and calmly thinking them through before answering will get easier. And understanding the types of questions you have been asked will make preparing for the next interview easier.

0

Personally I find it easier to acquire skills when I am not trying to learn them in a vacuum but have a practical way to apply them. So if you want to sharpen up your algorithm knowledge, then it can be useful to pursue some personal projects which actually require you to use algorithms. And let's face it: 95% of business applications do not require any complex algorithms which aren't found in the standard libraries of whatever technology stack you are using.

Some domains which require applied algorithm knowledge and are fun to work in are:

  • Game development
  • Simulations
  • Media encoding
0

Will I get better at programming interview questions if I keep doing them?

Absolutely!

Are there patterns that one learns eventually that one can apply to various interview questions?

Yes, of course.

But first, start with the easy problems on https://binarysearch.com/

The easy problems on that site are much easier than the ones on Leetcode.

Then, listen to Edbert Chan on youtube.

Will reasoning through the questions, failing, reasoning through the answer, etc. eventually help me come to these solutions on my own?

Yes, but if you're not making any progress after 30 minutes of struggling on a particular problem, you should look at the solutions in the discussion section and on youtube.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .