2
public List<Boolean> canMakePaliQueries(String s, int[][] queries) {3
List<Boolean> list = new ArrayList<>();6
// prefix map to count number of time each letters have occured to access in queries in O(1)17
int[][] map = new int[n + 1][26];18
for (int i = 0; i < s.length(); i++) {19
for (int j = 0; j < 26; j++) map[i + 1][j] = map[i][j];21
map[i + 1][s.charAt(i) - 'a']++;24
for (int[] q : queries) {30
for (int i = 0; i < 26; i++)32
(map[r + 1][i] - map[l][i])33
% 2; // count total characters that have odd count, so that we can replace the half34
// of them with their pair.36
list.add(count / 2 <= k); // if we can replace half of them with their pair