您的位置:首页 > 其它

CCI_chapter 1

2013-08-17 16:31 316 查看
1.1Implement an algorithm to determine if a string has all unique characters What if you can not use additional data structures?

bool isRotation(string s1, string s2){
if(s1.size() != s2.size()) return false;
if(s1.size() == 0) return true;
string ss = s1+ s1;
if(string::npos != ss.find(s2)) return true;
return false ;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: