4 ms, faster than 100.00% of C++ 1 Pass  Solution.
Let us Make an observation for following row [1,0,1,1]\n\n1)After row is reversed [1,0,1,1] -> [1,1,0,1]\n2)After inversion [1,1,0,1]->[0,0,1,0]\n\nCompleted pr
Let us Make an observation for following row [1,0,1,1]\n\n1)After row is reversed [1,0,1,1] -> [1,1,0,1]\n2)After inversion [1,1,0,1]->[0,0,1,0]\n\nCompleted process is\nA=[1,0,1,1] -> [1,1,0,1]->[0,0,1,0]\n\nLets take index i=0 and j = len-1 = 3\nA[i] = 1 and A[j] = 1 initially and their final values are A[i] = 0 A[j] = 0 \nfor i = 0 and j = 2\nA[i] =0 and A[j] = 1 initially and their final vales are A[i] = 0 A[j] = 1\n\n1)We can observe that when both the **values are same** there is no point in swaping to get reverse hence just **flipping the bits** is enough\n2)If the values are different such as 0,1 or 1,0 after they are reversed they become 1,0 and o,1 and then after flipping them become 0,1 and 1,0 which are its initial values.Hence we **do not need to make any change** for these values.\n\n\n```\nclass Solution {\npublic:\n    vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {\n        int n = A.size();\n        int m = A[0].size();\n        int j,i;\n        for(int k=0;k<n;k++)\n        {\n            i = 0;\n            j = m-1;\n            while(i<j)\n            {\n                if(A[k][i]==A[k][j]) // As bits are same we flip the bits using XOR operation\n                {\n                    A[k][i]^=1;\n                    A[k][j]^=1;\n                }\n                i++;\n                j--;\n            }\n            if(i==j) //In case of the row length is odd flip the  middle bit  as i==j have same bit\n                A[k][i]^=1;\n            \n        }\n        return A;\n    }\n};\n```
['Two Pointers', 'Bit Manipulation', 'C++']