Runtime: Beats 100%, Memory: Beats 91.26% (Simple Java Solution)
Intuition\nThe task is to first reverse all the contents of all the sub arrays inside the given two dimentional array, then to inverse the contents of the array
# Intuition\nThe task is to first reverse all the contents of all the sub arrays inside the given two dimentional array, then to inverse the contents of the array(ie. to replace 1 with 0 and vice versa).\n\n# Approach\nInvertion is the easy part, just an if-else loop to change 1 from 0 and vice versa.\nReversal is carried out by taking two variables each pointing to the extreme most end indices of the sub-arrays, then swapping them with the help of a temporary variable. this is carried out until the two indices variables don\'t cross each other.\n\nIn case you need a detailed understanding on how the program iterates and how the value of the variables change respectively for iteration, uncomment the reference code given in the code and run. \n\n# Upvote if you like my solution.\n\n\n# Code\n```\nclass Solution {\n    public int[][] flipAndInvertImage(int[][] image) {\n        int i = 0;\n        int a = 0;\n        int temp = 0;\n\n        //Reversal\n        while(i < image.length){\n            int b = image.length-1;\n            while(a <= b){\n                /*System.out.println(i);*/\n                temp = image[i][b];\n                image[i][b] = image[i][a];\n                image[i][a] = temp;\n                /*System.out.println(a+" "+b);*/\n                a++;\n                b--;\n                /*System.out.println(a+" "+b);*/\n            }\n            a = 0;\n            b = 0;\n            i++;\n        }\n\n//Output for reference.\n/*for(int o=0; o<image.length; o++){\nfor(int j=0; j<image.length; j++){\nSystem.out.print(image[o][j]);\n}\nSystem.out.println();\n}\nSystem.out.println();*/\n\n        //Inverting\n        for(int j = 0; j < image.length; j++){\n            for(int k = 0; k < image.length; k++){\n                if(image[j][k] == 0){\n                    image[j][k] = 1;\n                }else{\n                    image[j][k] = 0;\n                }\n            }\n        }\n\n//Output for reference.\n/*for(int o=0; o<image.length; o++){\nfor(int j=0; j<image.length; j++){\nSystem.out.print(image[o][j]);\n}\nSystem.out.println();\n}*/\n\n        return image;\n    }\n}\n```
['Java']