arpit2438735
BAN USERJust combine the string and find
if (str1.length() != str2.length())
{
return false;
}
int charsTracker[26] = {0};
for (int i = 0; i < str1.length(); i++)
{
charsTracker[str1[i] - 'a']--;
charsTracker[str2[i] - 'a']++;
}
for (int i = 0; i < 26; i++)
{
if (charsTracker[i] != 0)
printf("No");
}
printf("Yes");
}
I am from India and interested to get job but which organization you are talking about
- arpit2438735 August 25, 2012I have idea to solve this but this contain extra space and my algo is limit to 0-9 number and this code can check to n no of time number not repeated
b[10]={0,0,0,0,0,0,0,0,0,0}//Storing initial value to it for(i=0;i<array.length;i++)
{
if(b[array[i]])
{
b[array[i]]=b[array[i]]-array[i];//subtracting number if it is repeated
}
else
b[array[i]]=array[i];//storing value in array
}
for(i=0;i<10;i++)
{
if(b[i])
printf("%d",b[i]);
}
you didn't understand my solution it say that first I combine both A and B and make string 1 and then I am comparing with C ie string2...
- arpit2438735 September 02, 2012