nfactorial_

nfactorial_ nfactorial_

Niner since 2004

Software Engineer from the UK.

Discussions

Thread Replies Latest activity

gdi+ hardware acceleration

4

Comments

  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    That was an interesting clip Smiley

    The result I would have come up with would have been something similar to:

    bool IsPanlindrome( TCHAR *pszString )
    {
       if ( NULL == pszString )
          return false;

       const int length = lstrlen( pszString );
       const int repeat = length / 2;

       for ( int loop = 0; loop < repeat; ++loop )
       {
          if ( pszString[ loop ] != pszString[ length - 1 - loop ] )
             return false;
       }

       return ( 0 != length );
    }

    I say similar, because I would probably have been very nervous so it may not have been exactly the same. I also think I wouldn't have written as much pseudo code as in the video, as the simplicity of the question coupled with my nervousness may have had me thinking 'he just wants me to write the code'.

    I would have pointed out I was dividing the length by two because the integer arithmetic would simply discard the central character for odd length strings.

    n!