- 0
- 0
- 约4.68千字
- 约 13页
- 2016-12-12 发布于贵州
- 举报
华为2014笔试算法题汇总[cpp] view plaincopy
//////////////////////////////////////////////////////////////////////////
#include?iostream#include?cassertusing?namespace?std;bool?g_flag[26];void?stringFilter(const?char?*pInputStr,?long?lInputLen,?char?*pOutputStr){assert(pInputStr?!=?NULL);int?i?=?0;if?(pInputStr?==?NULL?||?lInputLen?=?1){return;}const?char?*p?=?pInputStr;while(*p?!=?\0){if?(g_flag[(*p?-?a)]){p++;}else{pOutputStr[i++]?=?*p;g_flag[*p?-?a]?=?1;p++;}}pOutputStr[i]?=?\0;}int?main(){memset(g_flag,0,sizeof(g_flag));char?input[]?=?abacacde;char?*output?=?new?char[strlen(input)?+?1];stringFilter(
原创力文档

文档评论(0)