Clean In Place Java Solution (One Pass, 0ms)
The logic is simular to swaping two position within an array but just done over many position. Idea is that you will perform the swap over every row of the matr
The logic is simular to swaping two position within an array but just done over many position. Idea is that you will perform the swap over every row of the matrix and only to the half way point of the row. When performing the swap, invert the value to achieve the invert. Inversion is done using 1 - cell value since it\'s only 1 and 0. (1 - 1 = 0, 1 - 0 = 1).\nHere is the code. \n```\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] A) {\n        for(int i = 0; i < A.length ; i++){\n            for(int j = 0; j < (A[0].length+1)/2; j++){\n                int temp = 1-A[i][j];\n                A[i][j] = 1-A[i][A[i].length-j-1];\n                A[i][A[i].length-j-1] = temp;\n            }\n        }\n        return A;\n    }\n}\n```\nIf you enjoy this solution, feel free to **upvote** it or **comment** to it if you have any question. I will be happy to answer.
['Java']