1.题目要求:
2.题目代码:
class Solution {
public://水平反转函数void replace_photo(vector<int>& array){for(int i = 0;i < array.size();i++){if(array[i] == 1){array[i] = 0;}else{array[i] = 1;}}}vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {//先进行水平翻转for(int i = 0;i < image.size();i++){reverse(image[i].begin(),image[i].end());}//再进行水品反转for(int i = 0;i < image.size();i++){replace_photo(image[i]);}return image;}
};