Java | Easy | 100% | 0ms | O(n)
Please Upvote\n\n\npublic int[][] flipAndInvertImage(int[][] image) {\n        int r = image.length, c = image[0].length;\n        int ans[][] = new int[r][c];\
# Please Upvote\n\n```\npublic int[][] flipAndInvertImage(int[][] image) {\n        int r = image.length, c = image[0].length;\n        int ans[][] = new int[r][c];\n        for(int i = 0; i < r; i++)\n            ans[i] = reverse(image[i]);\n        return ans;\n    }\n    public int[] reverse(int a[]){\n        int ans[] = new int[a.length];\n        int n = a.length;\n        for(int i = 0; i < n; i++)\n            ans[i] = a[n - 1 - i] == 0 ? 1 : 0;\n        return ans;\n    }\n```
['Java']