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.
defcount_substring(string,sub_string):count=0foriinrange(len(string)-len(sub_string)+1):# string.find returns -1 if false, but some other value if true. ifstring.find(sub_string,i,len(sub_string)+i)!=-1:count+=1returncount
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find a string
You are viewing a single comment's thread. Return to all comments →