Could any help me about my simple code?


  • 0
    L

    The following code is simple, but I get a runtime error called "Last executed input: [[1]]
    "
    Who can figure this out? thanks.

    void rotate(vector<vector<int>>& matrix) {
        int n = matrix.size();
        vector<vector<int>> newv;
        copy(matrix.begin(), matrix.end(), newv.begin());
    
            for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                matrix[i,j] = newv[n - j - 1, i];
            }
        }
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.