text: // Hi, I'm Yanzhan. I'm interested in all kinds of algorithmic problems. Also, I'm fascinated with javascript. If you want to learn more about programming problems and javascript, please visit my Youtube Channel (https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber), Twitter Account (https://twitter.com/YangYanzhan), GitHub Repo (https://github.com/yangyanzhan/code-camp) or HomePage (https://yanzhan.site/).
  
  // 开始分析
  // 1. 贪心。
  // 结束分析
  
  // 开始编码
  
  /**
   * @param {number[][]} grid
   * @return {number}
   */
  
  var matrixScore = function(grid) {
      var m = grid.length, n = grid[0].length;
      for (var i = 0; i < m; i++) {
          if (grid[i][0] == 0) {
              for (var j = 0; j < n; j++) {
                  grid[i][j] = 1 - grid[i][j];
              }
          }
      }
      var res = 0, base = 1;
      for (var j = n - 1; j >= 0; j--) {
          var n0 = 0, n1 = 0;
          for (var i = 0; i < m; i++) {
              if (grid[i][j] == 1) {
                  n1++;
              } else {
                  n0++;
              }
          }
          res += Math.max(n0, n1) * base;
          base *= 2;
      }
      return res;
  };
  