News for hackers. Stuff that matters.
Re:Google Tech Dev Guide by m0zg on Tuesday December 18, 2018 @09:59PM (#18712657)
It doesn't. This seems like a typical Google interview question. 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. And brute force solution will not get you a good grade in a tech interview at Google. It's idiotic: once you do get hired by Google, easily 80% of your work is copying one proto buffer into another, and the remaining 20% is mostly yak shaving and figuring out how things work in the absence of documentation. Dynamic programming should be the least of their concerns.
Re:Google Tech Dev Guide by ascar on Tuesday December 18, 2018 @10:10PM (#18712700)
That's probably the issue with algorithm solving is not software engineering and if you mostly select on the first, you do not necessarily get good people in the second, broader and more important area. Then you end up with a terrible system to work with.

It's like hiring construction engineers only based on their performance in structural analysis. Sure, it's important that the house doesn't collapse, but this will not get it build.

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.
Re:Google Tech Dev Guide by dbt00 on Wednesday December 19, 2018 @12:22AM (#18713248)
As someone who's done a ton of tech interviewing for a blue chip silicon valley firm, viewing this as a homework problem to which there is one correct answer is exactly not what I'm looking for. I want to see your problem solving skills and I'm curious about your knowledge base, but if you don't know any of the specific techniques and/or don't get to the specific optimal solution I'm looking for I really don't give a shit.
Re:Google Tech Dev Guide by SmirkingRevenge on Wednesday December 19, 2018 @01:11AM (#18713479)
This is the reassuring story every interviewer has to tell themselves to feel good about their decisions... and its the story every interview consultant tells the tech firm. But I tend to think its probably a just-so story, most of the time. All this work is done in the tech world to eliminate the subjectivity from interviews - this is how the subjectivity is re-introduced through the back door.
Re:Google Tech Dev Guide by webmaven on Wednesday December 19, 2018 @09:03AM (#18715640)
> this is how the subjectivity is re-introduced through the back door.

Exactly. You'd think that the large tech companies would insert "mystery shopper" candidates into the pipeline to uncover and measure the objectivity/subjectivity/bias of the interview process.

Re:Google Tech Dev Guide by jakebasile on Wednesday December 19, 2018 @12:39AM (#18713327)
Everyone says "it's not about the solution but how you go about solving it", but it's never been my experience as an interviewee. Every time I've been interviewed with one of these godawful trivia questions I've been denied even though I do my best to work with the interviewer to solve it. On the rare occasion I get feedback it has been because I didn't solve the problem optimally or some other nonsense.
Re:Google Tech Dev Guide by snaky on Tuesday December 18, 2018 @10:10PM (#18712701)
> figuring out how things work in the absence of documentation

That would be great interview test actually. Given a bunch of unknown code, add some simple functions, not breaking it apart. Keeping the style (not only syntactically) would be a bonus.

Re:Google Tech Dev Guide by m0zg on Tuesday December 18, 2018 @10:26PM (#18712773)
Yes, I actually implemented such a thing at a company I worked at after Google. We'd give the candidate a fairly simple and self contained codebase, and ask them to add a simple, incremental feature in the span of an hour. No limits on legitimate internet access, stack overflow, etc, and using their favorite text editor (we had several already set up). This worked great for us, as it selects for people who can solve practical problems in code they're not familiar with, which is bulk of the work of any software engineer.
Re:Google Tech Dev Guide by rhizome on Wednesday December 19, 2018 @02:12AM (#18713773)
While I'm not in a position to test it, I've thought for a while that companies should save their bugs, make an app that is similar enough to the work that these saved-off bugs can be put into it, then compare the candidate solutions with what your existing people came up with.
Re:Google Tech Dev Guide by AzzieElbab on Tuesday December 18, 2018 @10:19PM (#18712743)
oh no. are you saying google tech interviews are basically trivia
Re:Google Tech Dev Guide by AlexCoventry on Tuesday December 18, 2018 @10:56PM (#18712882)
> 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

Not with that attitude.

Re:Google Tech Dev Guide by onion2k on Wednesday December 19, 2018 @01:55AM (#18713666)
You're assuming that it's important to actually solve the problem. I'm not sure that's the case - it's really asking whether or not the candidate understands that brute forcing is a poor solution and determining whether they're capable of even looking for a better solution. A lot of developers find it very hard to look past the obvious first solution they find to a more efficient algorithm instead. Specifically companies like Google want to hire people who can do that deeper work.

The real issue with problems like this is when much smaller companies hiring a dev who'll be bolting together APIs and won't ever need to know an answer start to copy the technique believing "it's how you hire devs".

Re:Google Tech Dev Guide by ryacko on Wednesday December 19, 2018 @04:16AM (#18714342)
People buy SSDs so that FAANG single page apps take a minute to load.