3 ms·
I personally think the more design focused ones are good. EX: "Here's a system were building. How would you build it?" Then you build on that with "Ah, I see yo
by sushisource 9y ago
I personally think the more design focused ones are good. EX: "Here's a system were building. How would you build it?" Then you build on that with "Ah, I see you want to use a cache between these two servers/regions, what kind of cache would it be, what are some limitations there, etc?"
Or something like in the article where you start with a little code, and build on it to solve some problem that isn't a totally arbitrary tree traversal like most of the whiteboarding stuff seems to be.
- ng12 9y agoSee, I hate questions like that. They're completely face-level and easy to bullshit. I don't want to work at a company full of bullshitters.
- pkaye 9y agoI do the design focus based on the candidates own background... something they have worked on in their resume. This also help me confirm they didn't make things up on their resume. For the coding part, I try to pick things that don't depend on someone hearing about it previously. I try to solve the problem myself in 1/3 the time I allot to the candidate since they are under pressure. Most candidates seem to struggle with simple problem though. A simple one I have asked in C is to reverse the order of numbers in an array in place.
- billhathaway 9y agoIf you are trying a new coding or design question, have a few co-workers try it first to help flesh out the wording and get data points on how long it takes to solve.
- 0xfeba 9y ago> A simple one I have asked in C is to reverse the order of numbers in an array in place. Hm... int a[] = {1,2,3,4,5}; So, some kind of swap? for (x = 0, y = 4; x < 5; x++, y--) { a[x] ^= a[y]; a[y] ^= a[x]; a[x] ^= a[y]; } See, I wouldn't mind that on a whiteboard. I had similar question for a startup, and passed easily (I think!). But then the last question I got was 'find all word substrings in a string'. I struggled, giving a brute force answer (for each position in the string, check against dictionary and expand by one character until the end of the string), but struggled to improve on it. I didn't know about tries at the time, but even still it would be difficult for me to even try to code this on a whiteboard. Turns out it was "Google" question that was for optimizing runtime, and I cannot analyze like that on a whiteboard, unless it's obvious (nested for loops, etc.). Anyway, after struggling and giving up with that question the next guy came in and berated me and my current employer (defense contractor). Not sure if it was because they thought I wasted their time or what. I left after that--not someone I would want to work for.
- allenlavoie 9y agoIt's a nice xor swap, but I think you reversed your list twice. And xor swapping with x=y=2 is likely not ideal. Seems like exactly what I'd do in an interview too :p
- CodesInChaos 9y agoThe xor swap failure when working on the same variable has been nicely exploited in the underhanded C contest: http://www.underhanded-c.org/_page_id_16.html http://www.underhanded-c.org/_page_id_16.html > The XOR-swap trick is an example of coders being too clever for their own good. Here, it gradually poisons the RC4 permutation with zeroes, until eventually the plaintext is just passed along in the clear.
- 0xfeba 9y agoHa! Those are always good reads. Thanks.
- 0xfeba 9y agoSee, I'd need to run and debug it to figure all that out. But apparently some people can just write it all out on a whiteboard in one go.
- pkaye 9y agoShould have mentioned that temporaries are allowed. Also you swapped the array elements twice... The terminating condition should be x == y. Also if you changed this to a int *a (and a count), some people will get confused how to do this all with pointers. Asking how this would be tested is also a good question.
- jaredsohn 9y ago>The terminating condition should be x == y That assumes an odd number of elements (true in this case but not in general); I would recommend terminating when x >= y.
- UncleMeat 9y agoIsn't this just as bad as the "if you've seen this before" whiteboard questions? A lot of specific problem domains don't make for good general purpose questions. If I used my daily work as an interview question I'd insta-fail the large majority of candidates because they don't have relevant PhDs. There are good balances. The question I ask is a real problem for a real product but quickly reduces to something small and manageable rather than getting bogged down in incredibly specific requirements.