/**
*
*
* @see https://leetcode-cn.com/problems/flip-columns-for-maximum-number-of-equal-rows/solution/c-jian-dan-ti-jie-by-da-li-wang-21/
* @param {number[][]} matrix
* @return {*} {number}
*/
function maxEqualRowsAfterFlips(matrix: number[][]): number {
let max: number = 0;
const map: Map<string, number> = new Map<string, number>();
for (const rows of matrix) {
if (rows[0]) {
rows.forEach((value, index) => rows[index] = 1 - value);
}
const key: string = rows.join('');
const value: number = (map.get(key) || 0) + 1;
map.set(key, value);
max = Math.max(max, value);
}
return max;
};