News for hackers. Stuff that matters.
Re:Google Tech Dev Guide by SamReidHughes on Tuesday December 18, 2018 @10:26PM (#18712772)
> If you didn't know how to solve it before the interview started, you aren't going to figure out anything other than a brute force solution in 45 minutes.

I'd never heard this problem before and it took a few seconds to think of something better than brute force. Many colleagues I've worked with would too, and could probably improve on their first non-brute-force idea over the span of 25 minutes.

Re:Google Tech Dev Guide by m0zg on Tuesday December 18, 2018 @10:35PM (#18712812)
The problem here is the only non-bruteforce solution worth pursuing here involves DP with less-than-straightforward memoization rules, which the engineer is unlikely to actually use before or after the interview. So she has to waste a month studying _specifically for the interview_ and "refreshing" the skills she won't actually need on the job. It's like you're hiring a welder, but you want them to be good at juggling as well, just for the interview.

Don't get me wrong, I'm not saying DP is useless, it came in handy a couple of times over the course of my 20+ year career. I'm just saying that you could always look it up, and the amount of signal you get out of someone solving this problem is very close to zero, because it amounts to: "this person solved this problem before the interview", whereas the question you really need to answer is "can this person solve the problems we need solved".

Re:Google Tech Dev Guide by kagol on Tuesday December 18, 2018 @11:11PM (#18712950)
> The problem here is the only non-bruteforce solution worth pursuing here involves DP with less-than-straightforward memoization rules

The solution commentary [1] doesn't mention DP.

[1]: https://techdevguide.withgoogle.com/resources/find-longest-w...

Re:Google Tech Dev Guide by SamReidHughes on Tuesday December 18, 2018 @11:40PM (#18713052)
Actually looking at their "brute force" solution, what I was referring to as brute force was their "greedy" algorithm, and the first optimization I came up with was the most optimal solution. I'd call that a very natural strategy to take -- try doing the words simultaneously instead of separately, and you see it.

I don't even see that as DP.

Not everybody will be as quick as me, but there are plenty of people that don't spend a month practicing for a Google interview. If somebody is practicing solving data structures problems for the first time in their life, that's fine -- maybe they went to a substandard school. But if they have to spend a month refreshing any time they want a job, it means their brain drops skills they learn that are closely related to the job they do. That means their experience is worthless -- they aren't retaining it, long-term.

Re:Google Tech Dev Guide by LouisSayers on Wednesday December 19, 2018 @12:03AM (#18713161)
If the skills were closely related to your job, then it doesn’t make sense that you’d need to refresh those skills - as you would have been applying them at your job...

Sounds like the skills are the useless things, not the work experience.

Re:Google Tech Dev Guide by m0zg on Wednesday December 19, 2018 @12:40AM (#18713334)
That's not the point. I just automatically assumed a subsequence problem will involve DP. I only know this because I studied for interviews in the past, not because I ever had to solve a subsequence problem at work, and I've done some _very_ advanced stuff.

I posit that ability to solve such problems is completely irrelevant to one's job performance, at Google or anywhere else. Google's own test of this hypothesis (hiring a control group of people irrespective of their interview scores) seems to bear it out.

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @07:47AM (#18715221)
The point is you are claiming that people need to study up a month for a Google interview. My point is that there are many people who do not need to study up for a month, or at all. They walk in, get asked some fun little data structures problems, and solve them.

This idea that some people like to push, that these interviews are all about memorization, is a false one.

Re:Google Tech Dev Guide by webmaven on Wednesday December 19, 2018 @08:51AM (#18715553)
> Google's own test of this hypothesis (hiring a control group of people irrespective of their interview scores) seems to bear it out.

Link?

Re:Google Tech Dev Guide by pathseeker on Wednesday December 19, 2018 @06:04AM (#18714813)
>But if they have to spend a month refreshing any time they want a job, it means their brain drops skills they learn that are closely related to the job they do. That means their experience is worthless -- they aren't retaining it, long-term.

DP isn't used the vast majority of the time. That's not retaining "experience".

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @08:03AM (#18715282)
Your experience from 10 years ago isn't used the vast majority of the time either.
Re:Google Tech Dev Guide by AlexCoventry on Tuesday December 18, 2018 @11:02PM (#18712905)
> only non-bruteforce solution worth pursuing here involves DP

What's wrong with starting with a hashtable of substrings of fixed length? For inputs with low autocorrelation, that'll get you a good average-case speed up.

Re:Google Tech Dev Guide by seanmcdirmid on Tuesday December 18, 2018 @11:58PM (#18713137)
Have you studied cracking the coding interview before? If so, then I think you’ve probably seen similar problems.

I find these problems very annoying and I code a lot of clever algorithms in my research. But none of it is have the strong scanning variety, I mean, except lexing in a compiler.

And that’s how I would solve this problem in any case: I would just construct a scanner for D that would simply add to the state set rather than transitioning. That isn’t even in the canonical solution set, and anyways, would be considered too trivial as a test of compiler construction knowledge.

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @08:01AM (#18715273)
I've never specifically studied for programming interview questions, or read that book. Of course, when somebody asks a fun problem, online or something, such as here, I'll try to figure it out. And I also find "string problems" to be the worst, I think they're a particularly bad genre of algorithms question.

My claim was a very weak one, too. It was that somebody who never heard the problem before can get better than the brute force solution in 45 minutes. As m0zg intended it, that means better than 2^n*|D|, which is easily true. As I intended it, that people could do better than the "greedy" algorithm in 45 minutes, well, my image of a canonical developer is going to get the greedy algorithm right away, and then have 45 minutes to improve on it. And, I think they'd be able to accomplish that.

Re:Google Tech Dev Guide by seanmcdirmid on Wednesday December 19, 2018 @09:37AM (#18715832)
I guess if you are used to solving these problems, they become easy. Anyways, I would have never seen the greedy solution to this problem, and am just lucky that it is basically a compiler one if you look at it hard enough.

But if you aren’t in the mindset at all, these problems can be complete WTFs. For example, I just started interviewing recently and on one my first interviews someone gave me the house painting problem. I was completely stumped without knowing where to start, wasn’t familiar with the structure for solving these kinds of problems, and anyways these never really came up in my area of expertise. Ask me to write an interpreter, compiler, text editor, live programming system, reactive programming framework, I know all the tricks, but if you ask me to minimize the paint on a bunch of houses...

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @09:52AM (#18715938)
Is the house panting problem this one? https://www.programcreek.com/2014/05/leetcode-paint-house-ja...

I'd imagine you might want a bit of practice get refreshed. I know what you mean. But I'm guessing it's not a month of practice, and you're not thinking you have to memorize the problems beforehand.

For me, it's a similar background (interpreters, compilers, text editors) and for any algorithms interview, what always got me have been dynamic programming problems and remembering that hash tables exist.

Edit:

Funnily enough, one time on a phone screen, fresh out of college, I got asked directly what data structure I'd use for a text editor. The next words out of my mouth were, "a pair of finger trees," and it turned out that it didn't go well, I didn't get a follow-up interview.

Re:Google Tech Dev Guide by seanmcdirmid on Wednesday December 19, 2018 @10:08AM (#18716059)
Maybe not a month, but many have done it for a month to get that dream job at google, the possibility is there and that could be the competition you are calibrated against.

Ya, I think we are sometimes actually better off with the generic brain twister questions because the more specialized questions are harder evaluate. Like, my idea of writing a code editor might be completely different from yours because I’ve dealt with different requirements. And if the interviewer is junior enough (or not versed in the specialty), they might not be ready to have a serious discussion about trade offs and design spaces.

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @10:49AM (#18716415)
It does seem to me, reading online the past few years, like there has been an inflation in difficulty of a certain category of interview questions, as a result of people studying.

Usually, when interviewing people on an algorithms interview, I've asked an straightforward warm-up question, followed by a more interesting second question, that might be difficult for somebody that hasn't thought about anything interesting in 10 years. I don't think there was ever a situation where somebody got through the first just swimmingly, and then hit a wall on the second. The pain always starts on the warm-up question.

Re:Google Tech Dev Guide by seanmcdirmid on Wednesday December 19, 2018 @12:50PM (#18717624)
> that might be difficult for somebody that hasn't thought about anything interesting in 10 years.

Coming from doing research for the past 10 years and now looking for a dev job, I have the opposite feeling: all these interview questions (even the hard ones) are way too boring.

Re:Google Tech Dev Guide by m0zg on Wednesday December 19, 2018 @04:09PM (#18719652)
>> I've never specifically studied for programming interview questions, or read that book

You've also never been through a FANG interview, according to your LinkedIn profile. I've been through several (successfully), and conducted well over a hundred. It is very unlikely anyone can pass them without extra work to prepare.

Re:Google Tech Dev Guide by SamReidHughes on Wednesday December 19, 2018 @07:12PM (#18721298)
I didn't know my LinkedIn profile lists where I've interviewed.