Print 2-D Array in clockwise expanding spiral from center

前端 未结 4 1865
离开以前
离开以前 2020-12-02 00:18

I have an guaranteed to be a perfect square matrix. I want to start at the center of the matrix in this case it would be matrix[2][2], I know h

4条回答
  •  有刺的猬
    2020-12-02 01:02

    bool IsIterationComplete(int iteration, int nCenter, std::vector>& vVisited)
    {
        int nHigh = nCenter+iteration;
        int nLow = nCenter-iteration;
        //cout<>& vMat,std::vector>& vVisited, int row, int col, int nCenter, int iteration)
    {
        cout<=0 && !vVisited[row][col-1] && col-1>=nCenter-iteration)
        {
            cout<<"Left "<=0 && !vVisited[row-1][col] && row-1>=nCenter-iteration)
        {
            cout<<"Up "<> vMat;
        std::vector> vVisited;
        for(int i=0; i<7; i++)
        {
            std::vector row;
            std::vector visitedRow;
            for(int j=0; j<7; j++)
            {
                row.push_back(nCount);
                cout<

提交回复
热议问题