You are viewing a single comment's thread. Return to all comments →
i got time limit exceed in 2 test cases, how should i modify this code?
int stringSimilarity(string s) { int count=s.size(); for(int i=1;i<s.size();i++){ string str = s.substr(i, s.size()-i); for(int j=0;j<str.size();j++){ if(str[j] == s[j]){ count++; } else{ break; } } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
String Similarity
You are viewing a single comment's thread. Return to all comments →
i got time limit exceed in 2 test cases, how should i modify this code?