We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8799493 + 2f3fe71 commit ee6cd28Copy full SHA for ee6cd28
solution/0832.Flipping an Image/Solution.cpp
@@ -0,0 +1,18 @@
1
+class Solution {
2
+ public:
3
+ vector<vector<int>> flipAndInvertImage(vector<vector<int>> &A) {
4
+
5
+ int temp, Len = A[0].size();
6
7
+ for (int i = 0; i < A.size(); i++)
8
+ {
9
+ for (int j = 0; j < ((Len + 1) / 2); j++)
10
11
+ temp = !A[i][j];
12
+ A[i][j] = !A[i][Len - j - 1];
13
+ A[i][Len - j - 1] = temp;
14
+ }
15
16
+ return A;
17
18
+};
solution/0832.Flipping an Image/Solution.py
@@ -0,0 +1,14 @@
+class Solution:
+ def flipAndInvertImage(self, A):
+ """
+ :type A: List[List[int]]
+ :rtype: List[List[int]]
+ Len = len(A[0])
+ for row in A:
+ for i in range( (Len + 1) // 2 ):
+ row[i], row[Len - i - 1] = int(not row[Len - i - 1]), int(not row[i])
+ return A
0 commit comments