Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 662 Bytes

19.md

File metadata and controls

33 lines (25 loc) · 662 Bytes
int columnWithMaxZeros(vector<vector<int>>arr,int N){
        
        int max0=INT_MIN;
        int ans=-1;
        int temp;
        
        for(int i=0;i<N;i++)
        {
            temp=0;
            for(int j=0;j<N;j++)
            {
                if(arr[j][i]==0)
                    temp++;
            }
            
            if(max0<temp)
            {
                max0=temp;
                ans=i;
            }
        }
        
        if(max0==0)
            return -1;
        
        return ans;
        
        
    }