I failed a Twitter interview
61–70 of 86 posts
Re: I failed a Twitter interview
#62No 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…
"this is a seriously bad way of hiring developers" 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
#63I 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 few interviews I've had here are quite different, since most everyone comes with recommendations and the interviewer has a general idea of what work is at other companies. (I did have a test interview once, where I showed I was completely clueless about CSS, it really wasn't a position for me)
Re: I failed a Twitter interview
#64Earlier quoted context omitted.
ehm, no it is not so simple :-) I'll try better after lunch!
Thank you for posting this and demonstrating how absolutely pointless these questions are for finding qualified candidates. For those of you who didn't notice, antirez[1] makes a data storage system called "Redis"[2] [1]: https://twitter.com/antirez [2]: http://redis.io/
Edit: now that I read the solution, what I found is indeed the two passes solution and not the optimal one with the two pointers going in opposite directions.
Re: I failed a Twitter interview
#65 overall_max=0
index_of_overall_max=0
Second_max=0
index_of_second_max=0
Array_of_cumulated_Sum=0
Total=0
for i from left to right
if Height(i)>overall_max
//Water Area between new max and old max
Total+=overall_max*(i-index_of_overall_max+1)-(Array_of_cumulated_Sum(i)-Array_of_cumulated_Sum(index_of_overall_max))
overall_max=Height(i);
index_of_overall_max=i;
Second_max=0;
index_second_max=i+1;
else
if Height(i)>Second_max
//All the parts on second max is only to not miss the kept water at the end between the overall_max and another local max
Second_max=Height(i);
index_second_max=i
end
end if
Array_of_cumulated_Sum(i)=Array_of_cumulated_Sum(i-1)+Height(i)
end for
//At the end : water area between second max and overall max
Total += Second_max*(index_of_second_max-index_of_overall_max+1)-(Array_of_cumulated_Sum(index_of_second_max)-Array_of_cumulated_Sum(index_of_overall_max))
return TotalRe: I failed a Twitter interview
#66You can get a solution with simple Lagrangian method (which I believe is the linear solution).
http://www.eecs.berkeley.edu/~dtse/Chapters_PDF/Fundamentals...
(pages 183 - 185)
Re: I failed a Twitter interview
#67 make stack
water = 0
for n in columns
while stack not empty and n > stack top
water += min(stack bottom, n) - stack top
pop stack
stack push nRe: I failed a Twitter interview
#68Re: I failed a Twitter interview
#69Re: I failed a Twitter interview
#70you 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)
MISMATCH: [6, 7, 7, 4, 3, 2, 1, 5, 2] holds 10 (got 0) MISMATCH: [5, 3, 6, 7, 7, 4, 3, 2, 1, 5, 2] holds 12 (got 2)
Another mismatch: MISMATCH: [2, 0, 1] holds 1 (got 0) TRUE: [1, 0, 2] holds 1