Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Line 1034: Char 9: runtime error: reference binding to misaligned address 0xbebebebebebebebe for type 'int'

class Solution {
    private:
    void make_zero(vector<vector<int> >& matrix,vector<pair<int,int>>v,int n,int m)
    {
        for(auto i:v)
        {
            for(int j=0;j<n;j++)
            {
                matrix[i.first][j]=0;
            }
            for(int j=0;j<m;j++)
            {
                matrix[j][i.second]=0;
            }
        }
    }
public:
    void setZeroes(vector<vector<int>>& matrix) {
        
        int n=matrix.size();
        int m=matrix[0].size();
        vector<pair<int,int>>v;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(matrix[i][j]==0)
                {
                    v.push_back({i,j});
                }
            }
        }
        make_zero(matrix,v,n,m);
    }
};

>Solution :

n and m are swapped around in make_zero(), you confused the row and column dimensions.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading