ctci1.1

bool check(char * str){
    if(str == NULL)
        return true;
    int len = strlen(str);
    if(len == 0)
        return true;
    map<char,bool> place;
    int i = 0;
    for(i = 0; i < len; i++){
        if(place.find(str[i]) == place.end())
            place.insert(pair<char,bool>(str[i],true));
        else
            return false;
    }
    return true;
}
posted @ 2014-10-09 12:56  lycan785  阅读(93)  评论(0编辑  收藏  举报