题目:在一个字符串中找到第一个只出现一次的字符。如输入abaccdeff,则输出b。
分析:这道题是2006年google的一道笔试题。
#include "stdio.h" char FirstNotRepeatingChar(char* pString) { unsigned int i; // invalid input if(!pString) return 0; // get a hash table, and initialize it const int tableSize = 256; unsigned int hashTable[tableSize]; for(i = 0; i < tableSize; ++ i) hashTable[i] = 0; // get the how many times each char appears in the string char* pHashKey = pString; while(*(pHashKey) != '