You are viewing a single comment's thread. Return to all comments →
Don't fire a missile to kill a fly !!
Here is my simple C/C++ code. No built-in function, No special data-structures, only an int array of size 26 and one int loop variable. That's all.
string twoStrings(string s1, string s2) { int cc[26]={0}, i=0; while(s1[i]) cc[s1[i++]-'a']++; i=0; while(s2[i]) if(cc[s2[i++]-'a']) return "YES"; return "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Two Strings
You are viewing a single comment's thread. Return to all comments →
Don't fire a missile to kill a fly !!
Here is my simple C/C++ code. No built-in function, No special data-structures, only an int array of size 26 and one int loop variable. That's all.