Skip to content

Commit 0e3c575

Browse files
authored
832.Flipping an Image
832.Flipping an Image
1 parent cfebe7f commit 0e3c575

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

flipAndInvertImage.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
4+
vector<vector<int>> res;
5+
for(int i = 0; i < A.size(); i++) {
6+
vector<int>temp;
7+
for(int j = A[i].size()-1; j >= 0; j--) {
8+
bitset<1>bit(A[i][j]);
9+
temp.push_back((int)bit.flip().to_ulong());
10+
}
11+
res.push_back(temp);
12+
}
13+
return res;
14+
}
15+
};

0 commit comments

Comments
 (0)