Easy C++ Solution | 100% Time :)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n- First I\'ve copied the image array to new ans array.\n- then reversed e
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n- First I\'ve copied the image array to new `ans` array.\n- then reversed every array that is inside it`(as mentioned in question)`\n- then replaced every `0` value to `1`.\n- and every `1` value to `0`.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n`Upvote! It only takes 1 click :)`\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {\n        int n = image.size();\n        vector<vector<int>> ans = image;\n\n        for(int i=0;i<n;i++) {\n            reverse(ans[i].begin(), ans[i].end());\n            for(int j=0;j<n;j++) {\n                if(ans[i][j] == 0){\n                    ans[i][j] = 1;\n                }\n                else{\n                    ans[i][j] = 0;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```\n![Upvote.jpeg](https://assets.leetcode.com/users/images/c8af91b5-b6f6-463d-9ff5-3bbdf63eed2e_1680625991.9136252.jpeg)
['Two Pointers', 'Iterator', 'C++']