2026/2/11 15:31:39
网站建设
项目流程
石家庄网站建设蓝点,淮南网络宾馆,广东seo点击排名软件哪里好,做网站的小结Problem: 832. Flipping an Image 翻转图像 解题过程 耗时100%#xff0c;交换前后两个数字#xff0c;然后前后都 1 并1拿到翻转以后的数字#xff0c;最后奇数矩阵还需要处理最中间的那个数字 Code
class Solution {
public:vectorvectorint flipAn…Problem: 832. Flipping an Image 翻转图像解题过程耗时100%交换前后两个数字然后前后都 1 并1拿到翻转以后的数字最后奇数矩阵还需要处理最中间的那个数字Codeclass Solution { public: vectorvectorint flipAndInvertImage(vectorvectorint image) { int n image.size(); for(int i 0; i n; i) { for(int j 0; j n/2; j) { swap(image[i][j], image[i][n - j - 1]); image[i][j] ((image[i][j] 1) 1); image[i][n - j - 1] ((image[i][n - j - 1] 1) 1); } if((n1)1) { image[i][n/2] ((image[i][n/2] 1) 1); } } return image; } };