Java 100% faster logical solution
\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] img) {\n        int m=img.length,n=img[0].length;\n        for(int i=0;i<m;i++)\n        {\n  
```\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] img) {\n        int m=img.length,n=img[0].length;\n        for(int i=0;i<m;i++)\n        {\n            int l=0,r=n-1;\n            while(l<=r)\n            {\n                if(img[i][l]==img[i][r])\n                {\n                    if(img[i][l]==0)\n                    {\n                        img[i][l]=1;\n                        img[i][r]=1;\n                    }\n                    else\n                    {\n                        img[i][l]=0;\n                        img[i][r]=0;\n                    }\n                }\n                l++;\n                r--;\n            }\n        }\n        return img;\n    }\n}\n```
['Two Pointers']