Runtime: 1ms
\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] image) {\n        int[][] magic=image;\n        for(int i=0;i<magic.length;i++){\n            
```\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] image) {\n        int[][] magic=image;\n        for(int i=0;i<magic.length;i++){\n            reverse(magic[i]);\n        }\n        \n        for(int i=0;i<magic.length;i++){\n           for(int j=0;j<magic[0].length;j++){\n               if(magic[i][j]==1){\n                   magic[i][j]=0;\n               }\n               else if(magic[i][j]==0){\n                   magic[i][j]=1;\n               }\n           }\n        }\n        return magic;\n        \n    }\n    public void reverse(int[]nums){\n        int max=nums.length-1;\n        int half=max/2;\n        for(int i=0;i<=half;i++){\n            int temp=nums[i];\n            nums[i]=nums[max-i];\n            nums[max-i]=temp;\n        }\n    }\n}\n```
['Java']