- array-rearrange, Mathematical, Matrix

Maximize product of a matrix by repeatedly multiplying pairs of adjacent cells with -1

  #include using namespace std;  int maxProduct(vector arr){    int N = arr.size();              int cnt = 0;              int zeros = 0;          int maxValue = INT_MIN;      vector v;          for (int i = 0; i < N; i++) {          for (int j = 0; j < N; j++) {                          if (arr[i][j] < 0) {                                                  maxValue = max(maxValue,                               arr[i][j]);                cnt++;            }                                      if (arr[i][j] == 0)                zeros++;        }    }              if (zeros > 1) {        cout