We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
**This is the best i could do , it gives the accurate answer but it failed only the time related test case, if some one could optimize this code plz go for it **
defstringSimilarity(s):# Write your code herec=0foriinrange(1,len(s)):a=s[i:]forjinrange(len(a)):ifa[j]==s[j]:c+=1else:breakreturnc+len(s)
Cookie support is required to access HackerRank
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 →
**This is the best i could do , it gives the accurate answer but it failed only the time related test case, if some one could optimize this code plz go for it **