A few years ago I was entering the Silicon Valley job market and at that time looking for senior engineering positions. A good rule of thumb about interviewing if you haven’t done it in awhile is to at least somewhat accept that you’ll probably make a few mistakes on your first few tries. Simply, don’t go for your dream job first. There are a million nuances to interviewing that you’ve forgotten, and a few up-front, not-so-important interviews first will educate (or re-educate) about them.
One of the first places I interviewed was a company called gofish.com. As far as I know – gofish is an utterly different company now than when I interviewed there. I’m almost sure that everyone I met there no longer works there, so the actual company isn’t terribly relevant to the story. But the interviewer is. My technical interview there was with a guy named Guy.
Guy wore leather pants. Its a well-known fact that interviewers in leather pants are “extra” scary. And Guy was by no means a let down. He was also a technical crack-shot. And he was a technical crack-shot in leather pants – seriously, I didn’t have a chance.
One question he asked me I’ll never forget. In truth, its a pretty innocuous question – but it’s also pretty standard fare for silicon valley interviewing questions at that time.
Here it is:
Say you have one string of alphabetic characters, and say you have another, guaranteed smaller string of alphabetic characters. Algorithmically speaking, what’s the fastest way to find out if all the characters in the smaller string are in the larger string?
For example, if the two strings were:
String 1: ABCDEFGHLMNOPQRSString 2: DCGSRQPOM
You’d get true as every character in string2 is in string1. If the two strings were:
String 1: ABCDEFGHLMNOPQRSString 2: DCGSRQPOZ
you’d get false as Z isn’t in the first string.
Read the rest of this entry »