Skip to content

Commit 9751fd5

Browse files
832. Flipping an Image
1 parent 4ee68be commit 9751fd5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

832.Flipping_an_Image.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public int[][] flipAndInvertImage(int[][] image) {
3+
for(int i=0;i<image.length;i++){
4+
int low = 0;
5+
int high = image.length-1;
6+
while(low<=high){
7+
if(image[i][low]==image[i][high])
8+
image[i][low]=image[i][high] = 1-image[i][low];
9+
low++;
10+
high--;
11+
}
12+
}
13+
return image;
14+
}
15+
}

0 commit comments

Comments
 (0)