LeetCode—566. Reshape the Matrix


//url:https://leetcode.com/problems/reshape-the-matrix/description/

class Solution {
public:
    vector> matrixReshape(vector>& nums, int r, int c) {
        int xsize=nums[0].size();
        int ysize=nums.size();
        if(xsize*ysize!=r*c)
            return nums;
        vector> result;
        for(int i=0;i tmp(c,0);
            result.push_back(tmp);
        }
        
        for(int i=0;i

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注