public class TwoArray {
public int[] arrayPrint(int[][] arr, int n) {
int result[] = new int[n*n];
int temp = n-1;
int j =0, k =0;
while(temp >= -(n-1)) {
for (int i =0; i <= n-1; i++) {
j = i+temp;
if (j >= 0 && j <= n-1) {
result[k] = arr[i][j];
k++;
}
}
temp--;
}
return result;
}
}
牛客二维数组打印
最新推荐文章于 2023-04-15 14:27:12 发布