【leetcode】1252. 奇数值单元格的数目

int oddCells(int n, int m, int** indices, int indicesSize, int* indicesColSize){
    int i, j, cnt=0;
    int rhash[50]={0}, chash[50]={0};
    for(i=0; i<indicesSize; i++){
        rhash[indices[i][0]]++;
        chash[indices[i][1]]++;       
    }
    for(i=0; i<n; i++)
        for(j=0; j<m; j++)
            cnt += (rhash[i]+chash[j])%2;    
    return cnt;
}
原文地址:https://www.cnblogs.com/ganxiang/p/14055904.html