标签:return length java turn nbsp blog new logs pre
public int[][] func(int[][] nums,int r,int c){ int m=nums.length; int k=0; int n=nums[0].length; if(r*c!=m*n){ return nums; } int[][] res = new int[r][c]; for(int i=0;i<r;i++){ for(int j=0;j<c;j++,k++){ res[i][j]=nums[k/n][k%n]; } } return res; }
Leetcode566. Reshape the Matrix
标签:return length java turn nbsp blog new logs pre
原文地址:http://www.cnblogs.com/vector11248/p/6789520.html