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.
publicstaticList<String>weightedUniformStrings(Strings,List<Integer>queries){// Write your code hereSet<Integer>st=newHashSet<Integer>();charc=s.charAt(0);intwt=((int)c-96);st.add(wt);for(inti=0;i<s.length();i++){if(s.charAt(i)!=c){c=s.charAt(i);wt=((int)c)-96;st.add(wt);}else{wt+=((int)c-96);st.add(wt);}}List<String>str=newArrayList<String>();System.out.println(st);for(intx:queries)if(st.contains(x))str.add("Yes");elsestr.add("No");returnstr;}
Weighted Uniform Strings
You are viewing a single comment's thread. Return to all comments →