Hacker News new | ask | show | jobs
by Tmp1234 2905 days ago
The thing is I have no idea I need more planning. When I start to code the solution I've come up with seems genuinely complete and correct. It's only when the incorrectness hits me right in the face, usually in the form of test cases failing or not being able to code something I thought I could, that I realize I didn't have it.

To be concrete, yesterday I tried to solve this question: https://leetcode.com/problems/wildcard-matching/ I spent 45 minutes on the planning phase which would be the entire time I'd have for the problem in an interview. I had some pseudocode, thought through it, tried an example or two and then decided to code it up. As I did I realized a few more examples which I added in. Finally, I had some code that seemed even more correct than the code I thought was already correct. I run it and test cases fail. I spent 2.5 hours in total trying to get them all to pass without realizing the central issue of the question is what to do when you hit a * character. The necessity to try all the combinations of the string after a * doesn't not occur to me in 2.5 hours; I kept tweaking for specific cases I was failing. I ask a friend about the problem and in less than two minutes he realizes you need to try all combinations.

>>What sort of ideas and logic are you specifically having problem with?

It seems everything. Sure, some problems turn out to have an algorithm that I didn't know about it. Like the other day I was trying to do a problem that basically needed topological sort and I never really learned top sort. But then I read in the solution in CTCI that it's reasonable to derive that on one's own in a 45 minute interview so there goes that. More generally, it just seems when a problem reaches a certain level of difficulty my brain simply can't solve it. I suspect it's an intelligence thing. I just don't have a high enough IQ to get passed a certain point.

I will look at the resources you mentioned.

1 comments

>>I spent 2.5 hours in total trying to get them all to pass without realizing the central issue of the question is what to do when you hit a * character. The necessity to try all the combinations of the string after a * doesn't not occur to me in 2.5 hours;

The fact you kept trying for 2.5 hours shows you are persistent -- an awesome ingredient to be a great programmer. In my opinion, you shouldn't blame yourself for not being able to solve that particular wildcard-matching problem. I think it's a typical "interview problem". I personally don't think "interview problem" is a good measure of a programmer because: 1. some people are more gifted in the thinking required to solve such problem. 2. if you practice a lot, basically you get better at it. It's like there's a certain pattern to such problems that you can learn. (think of it as similar to SAT)

>>Sure, some problems turn out to have an algorithm that I didn't know about it.

I'm not suggesting you need to know a lot of algos to be a great programmer. You just need to be familiar with the important ones such as linked list, hash map, binary tree, etc. Cos even at places like Google, they wouldn't really ask interview questions where you need to know anything unconventional. What I'm suggesting is that you learn to solve problem by reading solutions to existing algo problems, make sure you understand it, and try to re-implement it.

>>I just don't have a high enough IQ to get passed a certain point.

From your comments, it seems you think you have to be good at "interview problems" or what I like to call "algorithmic-thinking" to be a good programmer. I totally understand that perspective as most US tech companies' screening process involve such problems. I'm telling you from experience though, that computer science is much more than just "algorithmic thinking". There is the field of system where the main challenge is to envision how all the large number of components collaborate and work together (i.e. OS, distributed system). There is also the field of frontend web programming. Frontend involves the skill of implementing something that is visually aesthetic or implementing a web according to the design document. There's also product management role, where you have to understand the how the thing works but you don't have to go too technical. And many more.

In short, there are so much more in the CS than just "algorithmic thinking". Don't be discouraged. Try to figure out where your interest and talent intersect, work hard on it, and don't easily give up :)

It seems we both agree, indirectly, that these interview tests are like IQ tests. You are comparing them to the SATs and the SATs are just wrapped up IQ tests like the tech interview. Studies have shown scores on the SAT don't increase by more than 100 points or so even with 100s of hours of practice. In the end, the algorithmic thinking you mention just seems like another way of saying intelligence which would be a factor in any subfield I enter.

And the truth is I've been doing interview prep on and off for at least a year and I'm still at this stage. My goal is to be good enough to get into a Big 4. If I can't do that, I don't want to continue. Given that, do you think I should quit?

Honestly, I feel like your motivation is wrong. Most of the most amazing programmers are those that are genuinely interested in particular topics, worked hard in the area, and finally became very good at it. Your mindset really shouldn't be going to big 4 because they're cool or sound prestigious. I don't believe such mindset will last long there anyway...

Aside from personal opinion above, the chance of getting to Google is less than the chance of getting accepted to Harvard. And as you probably know, there are people who are qualified who got turned down by Harvard because they don't have enpugh spots anyway. So if your goal is merely to get there, statistically speaking there are much more plausible things to aim for, so you shouldn't waste your time..