News for hackers. Stuff that matters.
Re:A Google Interviewing Story by jakevoytko on Friday November 19, 2010 @09:24PM (#1923633)
The array is a pretty obvious solution (to me, anyways). But the hash table has an added benefit.

Consider the following string, where   is a non-breaking space:

   Main string: "Counter example:  _à²"
   
   Shorter string: "ಠ_ಠ"
Re:A Google Interviewing Story by blinks on Saturday November 20, 2010 @12:24AM (#1923928)
Note: "Say you have one string of alphabetic characters"

The array of bools, bitmap (remember 32-bit int!), hash map; all are the same basic deal, easy to understand code, etc. Any would probably be fine, imho.

Hash map would be my initial implementation, though, if only because I don't know where it would be used, and the map will be immediately understood.

Re:A Google Interviewing Story by barrkel on Saturday November 20, 2010 @03:20AM (#1924120)
I come from a compiler background. When I hear "alphabet" I don't think a-z - I think of an arbitrary set of distinct symbols that can be arranged into a string.
Re:A Google Interviewing Story by TheNewAndy on Saturday November 20, 2010 @03:35AM (#1924134)
Yes, but even in compiler land, you don't say "alphabetic" to mean a symbol taken from your particular alphabet (since that is practically a given... a symbol outside the alphabet might as well not exist).
Re:A Google Interviewing Story by jpeterson on Saturday November 20, 2010 @10:44AM (#1924639)
The array is a pretty obvious solution (to me, anyways).

Well, I guess not everyone is an amazing genius like you.