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.
functionweightedUniformStrings(s:string,queries:number[]):string[]{letweightOjb={}asany;letwindowStart=0;while(windowStart<s.length){constcharWeight=s[windowStart].charCodeAt(0)-96;// add a new elementweightOjb[charWeight]=1;// record uniform string numberletwindowEnd=windowStart+1;letweight=charWeight;while(s[windowStart]===s[windowEnd]){weight+=charWeight;weightOjb[weight]=1;windowEnd++;}windowStart=windowEnd;}constresult=queries.map((query)=>weightOjb.hasOwnProperty(query)?'Yes':'No');returnresult;}
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 →
TypeScript