vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
    vector<vector<int>> B;
    for (int i = 0; i < A.size(); i++)
    {
        vector<int> Row = A[i];
        vector<int> Row2;
        for (int j = Row.size() - 1; j >= 0; j--)
        {
            int n = Row[j];
            if (n == 0)
            {
                Row2.push_back(1);
            }
            else
            {
                Row2.push_back(0);
            }
        }
        B.push_back(Row2);
    }
    return B;
}

 

posted on 2018-09-27 13:31  Sempron2800+  阅读(94)  评论(0编辑  收藏  举报