比较字符串

代码:
class Solution {
public:
/**
* @param A: A string includes Upper Case letters
* @param B: A string includes Upper Case letter
* @return: if string A contains all of the characters in B return true
* else return false
*/
bool compareStrings(string A, string B) {
// write your code here

if(B.size()>A.size())
return false;

/*map<char,int> map_A,map_B;

for(int i=0;i<A.size();i++){
map_A[A[i]]++;
}
for(int i=0;i<B.size();i++){
map_B[B[i]]++;
}

map<char,int>::iterator it=map_B.begin();
while(it!=map_B.end()){
int cnt=map_A.count(it->first);
if(cntsecond)
return false;
}

return true;
*/

posted on 2017-08-17 22:47  p666  阅读(141)  评论(0)    收藏  举报

导航