Posted on

Description

Submission

class Solution {
public:
    vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
        for(auto& a: A) {
            reverse(a.begin(), a.end());
        }

        for(auto& a: A) {
            for(auto& x: a) {
                x = 1 - x;
            }
        }

        return A;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *