There was an error while loading. Please reload this page.
1 parent 09c2f9c commit dfb9fadCopy full SHA for dfb9fad
861-flipping-an-image/flipping-an-image.cpp
@@ -0,0 +1,17 @@
1
+class Solution {
2
+public:
3
+ vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {
4
+ int iS = image.size();
5
+ vector<vector<int>> flipped(image.size());
6
+ for (int i=0; i<image.size(); i++){
7
+ for (int j=image[i].size()-1; j>=0; j--){
8
+ if (image[i][j]==0) {
9
+ flipped[i].push_back(1);
10
+ } else {
11
+ flipped[i].push_back(0);
12
+ }
13
14
15
+ return flipped;
16
17
+};
0 commit comments