1251-1260

1251. Average Selling Price $\star$

1252. Cells with Odd Values in a Matrix $\star$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class Solution {
 public:
  int oddCells(int n, int m, vector<vector<int>>& indices) {
    int ans = 0;
    vector<int> rows(n);
    vector<int> cols(m);

    for (vector<int>& indice : indices) {
      rows[indice[0]] ^= 1;
      cols[indice[1]] ^= 1;
    }

    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) ans += rows[i] ^ cols[j];

    return ans;
  }
};

1253. Reconstruct a 2-Row Binary Matrix $\star\star$

1254. Number of Closed Islands $\star\star$

1255. Maximum Score Words Formed by Letters $\star\star\star$

1256. Encode Number $\star\star$

1257. Smallest Common Region $\star\star$

1258. Synonymous Sentences $\star\star$

1259. Handshakes That Don't Cross $\star\star\star$

1260. Shift 2D Grid $\star$