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.
Weighted Uniform Strings
Weighted Uniform Strings
Sort by
recency
|
802 Discussions
|
Please Login in order to post a comment
Pretty plain code. def weightedUniformStrings(s, queries): # Write your code here
Here is a solution in python with O(n + m) time and O(m) space.
The space is in part because althogh the set cat grow as large as 26, values can be access at O(1) and the queries are the values that we search for in the set at a time of O(m) and equel space.