boneman boneman Who, me?

Niner since 2004


  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    There's lots of code already here, so I won't add mine, but there are some issues such as desired behavior (and security) that should be addressed prior to coding, and I'm rather surprised they haven't been addressed yet in this thread.

    How is the algorithm to handle punctuation and whitespace?  My thoughts are to strip them off prior to the forward/reverse iterative checking loop.

    When dealing with TCHAR's the issue of internationalization needs addressed; this introduces some other interesting concepts.

    Should case be considered?  Some languages have single character lower case but that same "character" in upper case is actually two characters (ala the German ß (sharp-s).  This makes for interesting buffer manipulation.

    Should accented characters be accepted as equivalent to non-accented characters?  In Turkish, there are four representations of the letter 'i' that are all equivalent if you are ignoring case. 

    Should we even consider the culture of the source string, or assume the current culture?

    Last, but not least, is the issue of string length.  These days, I am surprised that the interviewer/interviewee did not add a string length parameter, stipulate the string is null-terminated, or better yet #include strsafe.h above the function prototype.

    I'm also wondering if asking for these types of clarifications is too much - the interviewer may be thinking "get on with it already, I just want to know if you understand pointer arithmetic!"