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.
Yes it is more than O(n). But do these minor changes to make it linear...
for(inti=0;i<s.length();){sum=0;intj;for(j=0;j<s.length()-i&&s[i]==s[i+j];j++){//find the weight of current substringsum+=s[i+j]-'a'+1;//make note of it.weight[sum]=true;}i=i+j;}
Weighted Uniform Strings
You are viewing a single comment's thread. Return to all comments →
Yes it is more than O(n). But do these minor changes to make it linear...