首页 > 其他分享 >832. Flipping an Image

832. Flipping an Image

时间:2023-01-11 13:00:46浏览次数:49  
标签:832 temp int Image Flipping ++ vector size


​​cpp 
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
for (int i = 0; i < A.size(); ++i) {
for (int j = 0; j < (A[i].size()/2); ++j) {
int temp = A[i][j];
A[i][j] = A[i][A[i].size() - 1 - j];
A[i][A[i].size() - 1 - j] = temp;
}
for (int j = 0; j < A[i].size(); ++j)
A[i][j] == 0 ? A[i][j]=1 : A[i][j]=0;
}
return A;
}


标签:832,temp,int,Image,Flipping,++,vector,size
From: https://blog.51cto.com/u_14035071/6002144

相关文章