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.
I'm not sure about the step where you sort s, for two reasons.
This brings the runtime up to O(x*log(x)), where x = |s|.
The problem specifies contiguous substrings. Sorting would create longer uniform strings in some cases (ex. s = 'aca', x_i = 2) that shouldn't be in the set of weights.
Is there something I'm missing? Maybe the test cases don't have long enough strings or ones like the example I gave.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weighted Uniform Strings
You are viewing a single comment's thread. Return to all comments →
I'm not sure about the step where you sort s, for two reasons.
Is there something I'm missing? Maybe the test cases don't have long enough strings or ones like the example I gave.