Live data from Hacker News

How to win the coding interview

blog.devmastery.com

291–300 of 305 posts

Re: How to win the coding interview

#291

Earlier quoted context omitted.

What's your preferred solution?

Nothing more complicated than this: is_a_palindrome(S) { assert is_a_string(S) if reverse(S) == S return true return false } A string is a palindrome if it's equal to itself reversed. The example "solution" in the article is dreadfully overengineered to death and back. Noone interviewing should be happy to see such a solution and noone being interviewed should expect to be required to give such a solution, to such a…

That solution would fail to catch several of the examples that were requested to be caught. Sometimes something that appears overengineered is built that way to meet the actual requirements a problem presents.

Re: How to win the coding interview

#292

Earlier quoted context omitted.

I've had students that did this. It's a real pain to read code like that, and the 2nd time they handed it in, it was an automatic fail. Comments explain assumptions, and often "the why", never "the what" unless it's obscure because of optimizations.

I agree with the other commenters that say thats a bit harsh to completely fail them. I was in my third CS class in college and I left out a semi colon on a test and my teacher said, none of the code would work from here, so the answer is just 100% wrong. Even though the rest was 100% correct. I made the argument that if I was sitting at a computer, that would have been less than a 5 second mistake, or something I wo…

Failing for missing semi colon seems harsh, but in reality, when students are told to run their code before handing it in, a missing semi colon tells you exactly that the students didn't run the code. If a student fails to meet simple basic requirements, they cannot expect some leeway.

That said, in a test when hand writing code it should only be pseudo code. Expecting learners to write syntax correct code by hand is stupid.

    > why not let students be creative with their comments, even if its redundant to you.
Because I have to read every comment, decide if it's relevant or not, and delete it if it isn't. "End of line comments" on every single line is not helping anyone - "using for loop to iterate over the array" is bloody useless, because it's right there in the code. Keep in mind this is CS students at least 2 years in.

Re: How to win the coding interview

#294

Earlier quoted context omitted.

I agree with the other commenters that say thats a bit harsh to completely fail them. I was in my third CS class in college and I left out a semi colon on a test and my teacher said, none of the code would work from here, so the answer is just 100% wrong. Even though the rest was 100% correct. I made the argument that if I was sitting at a computer, that would have been less than a 5 second mistake, or something I wo…

Failing for missing semi colon seems harsh, but in reality, when students are told to run their code before handing it in, a missing semi colon tells you exactly that the students didn't run the code. If a student fails to meet simple basic requirements, they cannot expect some leeway. That said, in a test when hand writing code it should only be pseudo code. Expecting learners to write syntax correct code by hand is…

Keep in mind this is CS students at least 2 years in.

I wasn't keeping that in mind. Thats makes a lot of difference. Pretty sure I studied under the same rules.

Re: How to win the coding interview

#295

Earlier quoted context omitted.

The most common dialect is PCRE. Most languages have an implementation of either that or a superset of it.

The most common dialect is PCRE. Most languages have an implementation of either that or a superset of it. PCRE isn't exactly simple to begin with. That languages may implement it, or a superset of it, is exactly the problem. I know regular expressions very well, or rather I know regular languages and can fairly easily identify if a problem is solvable as a regular expressions. But once you start to go beyond that, i…

If you know what . does, various repetition markers (*,+,?,{}), and character classes, you're 90% there. Back-references are another big portion, although that's admittedly where things start getting a bit complex.

Re: How to win the coding interview

#296
post #213
post #121

Earlier quoted context omitted.

I came here to make the same comment (pardon the pun.) This article takes such an expert tone. But it's just opinion. For me, that comment would be a red flag. He also says to write the most efficient code possible. Then doesn't. See the comments at the end of the post. Overall, I think what this shows is that as an interviewee, the best thing you can do is try to get an idea of the interviewer's expectations as quic…

You might get have done better if you remembered the criterion correctly. Almost every data type used in computing is represented by non-fixed-length strings over a fixed alphabet (usually {0,1}). Radix sort is O(n) in log(dictionary size) which is only a useful bound when the data set is larger than the dictionary (this is a severe but not fatal requirement. Some datasets have many duplicate values, and anyway in pr…

You're right. I misstated it here and was clearly lying when I said I understood it.

Another good tip for interviewees: If you don't really understand something well enough to explain it, sometimes it's better not to bring it up than to introduce it and look silly. Sucks. But you're more likely to lose points than gain them for just kind of knowing something exists.

Also applies to hacker news comments ;)

Re: How to win the coding interview

#297

Earlier quoted context omitted.

Failing for missing semi colon seems harsh, but in reality, when students are told to run their code before handing it in, a missing semi colon tells you exactly that the students didn't run the code. If a student fails to meet simple basic requirements, they cannot expect some leeway. That said, in a test when hand writing code it should only be pseudo code. Expecting learners to write syntax correct code by hand is…

Keep in mind this is CS students at least 2 years in. I wasn't keeping that in mind. Thats makes a lot of difference. Pretty sure I studied under the same rules.

I wasn't exactly clear on that, to be fair.

Re: How to win the coding interview

#298

Earlier quoted context omitted.

Pseudocode has a definition, you can't just make one up in an attempt to not look foolish. No, automation with AI. DSS mostly. Stacks aren't just for web. I guess if you are unwilling to share your stack or any information other than the fact that you write stuff on paper and don't know what pseudocode is, then we don't have much to discuss, and you haven't really made any convincing arguments to your "superior" codi…

> Pseudocode has a definition, you can't just make one up I'm using exactly the same definition: pseudocode is a made-up language which may or may not vaguely resemble some existing language features. > Stacks aren't just for web. Yet, only hipstors use this word in such a context. I explained the methodology in detail. It is agnostic of a target language or even problem domain. I'm using it even when I'm writing a p…

You have a strange view of reality, my friend.

Re: How to win the coding interview

#299

Earlier quoted context omitted.

> Pseudocode has a definition, you can't just make one up I'm using exactly the same definition: pseudocode is a made-up language which may or may not vaguely resemble some existing language features. > Stacks aren't just for web. Yet, only hipstors use this word in such a context. I explained the methodology in detail. It is agnostic of a target language or even problem domain. I'm using it even when I'm writing a p…

You have a strange view of reality, my friend.

A mindless keyboard stomper is trying to say something about a "reality". Funny.

Go, solve your "2+2" problems. Hope you have a high enough character-per-second typing rate for this.

Re: How to win the coding interview

#300

Earlier quoted context omitted.

You have a strange view of reality, my friend.

A mindless keyboard stomper is trying to say something about a "reality". Funny. Go, solve your "2+2" problems. Hope you have a high enough character-per-second typing rate for this.

Let it go, you're wrong. It's obvious that you know you're wrong, otherwise you would argue your position rather than throwing personal insults and a hissy fit.

Pseudocode is not code. Flowcharts are not pseudocode.

You also didn't describe your stack. I just see some fresh meat who desperately wants people to take him seriously, but he has a hard time with it because he's kinda childish, very defensive, and can't argue his point.

Anyway, this discussion is counterproductive, so I'm going to stop reading after this one.

Post reply on HN