blob: 000fb94dc1ba18592340a4fdc12def9f7dd870f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <vector>
using std::vector;
class Solution {
public:
vector<vector<int>> flipAndInvertImage(vector<vector<int>> &A) {
const int row_count = A.size();
const int col_count = A.front().size();
std::vector<std::vector<int>> result(row_count,
std::vector<int>(col_count));
for (int i = 0; i < row_count; i++) {
for (int j = 0; j < col_count; j++) {
result[i][j] = !A[i][col_count - j - 1];
}
}
return result;
}
};
|