|
|
发表于 2013-7-4 22:56:15
|
显示全部楼层
死方法:(唐老师的O(0)解法是啥啊?)- int GetResult(const char *input, char *output)
- {
- int ret=-1;
- int condition=1;
- int i,len,j,k=0;
- len=strlen(input);
- condition = condition&&(input!=NULL)&&(output!=NULL);
-
- if(condition)
- {
- for(i=0;i<len;i++)
- {
- for(j=0;j<k;j++)
- {
- if(output[j]==input[i])
- break;
- }
-
- if (j==k)
- {
-
- output[k++]=input[i];
- }
-
-
- }
- output[k]='\0';
- ret=0;
-
- }
-
- return ret;
-
- }
-
复制代码 |
|