you could solve this with a simple state machine; there's no reason to resort to parlour tricks... https://gist.github.com/igor47/7228586
try this test case ([5,1,0,1],1)
I failed a Twitter interview
41–50 of 86 posts
Re: I failed a Twitter interview
#42No offence to Twitter, but this is a seriously bad way of hiring developers. What are you trying to recruit mathematics scholars as developers? When will companies like Twitter learn not all great developers are math geniuses? I didn't even get a college education to get where I am, I failed maths in school as well, but I can code, so what does that mean? I think it means nothing in the greater scheme of things. By t…
We can't reasonably assume that Twitter uses this sort of question in all their developer interviews. We don't have enough data for that. Perhaps this guy was going for a role where solving problems quickly and under pressure was a key requirement. If that were the case, this is pretty much a perfect interview question.
Re: I failed a Twitter interview
#43Re: I failed a Twitter interview
#44I had two phone screenings with Amazon recently and they decided not to continue with my application. It was depressing to me and I felt down for quite a bit, mainly because on the second phone screening I just couldn't do the coding task asked. My mind went blank and I probably sounded like a 5 year old struggling through the simplest of questions. It's my own fault though, I just got more and more stressed over the…
The result was that I started working really hard on side projects to see if I was really capable of working up there. That was the beginning of last year, and that pattern of work hasn't stopped. I've learned and built a lot.
About phone interviews though, I've been requesting Google Hangout interviews in place of them. And I've been a lot more comfortable I think because of the face-to-face interaction. Something to think about.
Re: I failed a Twitter interview
#45Re: I failed a Twitter interview
#46I can't imagine a construction engineering company asking their applicants to do a construction calculation in an interview, and in this case, bad design can actually kill people (as opposed to a bug at twitter).
What else does it bring apart from some amusement to the interviewer?
Re: I failed a Twitter interview
#47This question involves an "a-ha" moment (for the linear-time solution) and was thus banned from interviews at Google last year. Don't use questions involving eureka moments. They reveal nothing about the candidate. Edit: It should be noted that this question was used for a long time at Google, Microsoft, and many other places. It's a terrible question.
No, it doesn't involve the "a-ha" moment. Two-pass solution is obvious, just look at the final state. Once you are at that, the one-pass is a run-of-the-mill optimization of switching from accumulating and then processing the state to doing it all in parallel. The ability to recognize when this is doable is a good way to tell someone who's done it before (in some other context) from those who merely wrote a functiona…
Re: I failed a Twitter interview
#48Re: I failed a Twitter interview
#49Re: I failed a Twitter interview
#50I remember last year I got a similar question from both Twitter and Fb. It's really just a buckshot. Sometimes you'll get a problem that comes easy and sometimes you'll be sitting there dumbstruck.
Best of luck with your future interviews.