3 ms·
Has anyone actually answered this question on the spot without help and without knowing it? Probably not without help, but then how do we judge the amount help
by aleyan 12y ago
Has anyone actually answered this question on the spot without help and without knowing it? Probably not without help, but then how do we judge the amount help given to an interviewer?
I have been going through my own crises of interview question. My go to question for interviews which I have asked of about half a dozen candidates so far, wasn't completely flubbed only once. The only people I know who gave the good answers besides myself were my boss and our intern from MIT during mock interviews. I have been grading the candidates not on being able to write the solution in code like I intended, but on being able to come up independently with bits needed for the solutions. This has been quite unsatisfactory. How do I know if my question is too hard, or if something else is wrong, like prescreening of candidates?
- phamilton 12y agoI have. I had help, but the process was just like any other problem. State constraints. Look for a violation of constraints. Sort of like proof by contradiction. I can't remember the actual hints. I blitzed through 3 or 4 naive solutions first. My favorite was using tagged pointers to mark visited nodes. Eventually through a combination of hints and exploration I got to the idea of using two cursors. At that point it was a simple constraint about which cursor would be in front of the other and if there was a violation of that constraint it could only be because of a cycle. It made for a good interview, but there was good chemistry between myself and my interviewer. Any question would have worked in reality.
- alain94040 12y agoYes, I did figure it out. Actually, the answer I came up with was slightly different: it was pretty clear that I had to move the first pointer to get inside the cycle. Once I was inside, I thought the second pointer would need to move a lot to find the cycle, rather than just going two hops. So I proposed to advance the first pointer by n, and the second one by exp(n). Maybe it would go faster, who knows. By the way, this was the question at my first interview ever, so I do remember it quite well. PS: I interviewed many candidates since, and I would never ask such a question.
- anon4 12y agoCan you tell us what that question is? Not details, but the general idea. Me, I'd ask them this: 1. Write a function that takes a string of hex digits and converts them to a long (or equivalent in the language). Keep code minimal. 2. The opposite. Keep code minimal. 3. Write a function that reverses a UTF-8 encoded string (provide a good reference to the UTF-8 format), keeping combining characters in the reversed string in the same order they were in the original. I.e. aüç should be çüa, not ¸c¨ua. Assume the string of bytes is a proper utf-8 string, that only combining characters have to be order-preserved and that the only combining characters are the ones with unicode character codes in these ranges: (give them some standard ranges). Keep code minimal. Anybody who can do these three things should be able to learn most any other tech stack you throw at them. If on the other hand you're looking for people with specific expertise with a given branch of computer science, then you need a different set of tests. The central question is - do you need a developer or a mathematician specialising in discrete mathematics. Those are two different sets of people, though they tend to overlap.
- bitL 12y agoYes, I had it during 1st phone screen with Microsoft, coding it in their interviewing system and I figured out the two pointer version without a prior knowledge.
- SixSigma 12y agoI instantly knew, with no pre-knowledge, of two of the sub-optimal solutions presented in this thread that require O(n) storage. The optimal one, no but I didn't try any further than the solutions I had.