You are viewing a single comment's thread. Return to all comments →
//java public static List<String> weightedUniformStrings(String s, List<Integer> queries) { List<String> response=new ArrayList<>(); List<Integer> weight=new ArrayList<>(); weight.add(s.charAt(0)%96); for(int i=1;i<s.length();i++) weight.add(s.charAt(i)==s.charAt(i-1)?s.charAt(i)%96+weight.get(i-1):s.charAt(i)%96); queries.stream().forEach(q->response.add(weight.contains(q)?"Yes":"No")); return response; }
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 →