You are viewing a single comment's thread. Return to all comments →
List<int> weight = new List<int>(); int count = 1; for (int i = 0; i < s.Length; i++) { if(i == 0) { weight.Add(s[i] % 32); continue; } if(s[i] != s[i - 1]) { weight.Add(s[i] % 32); count = 1; } else { count++; weight.Add((s[i] % 32) * count); } } List<string> result = new List<string>(); foreach (var item in queries) { if (weight.Any(x => x == item)) { result.Add("Yes"); } else { result.Add("No"); } } return result;
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 →