//一破题付出血的代价 多思考!
public static void offer(int [][]a){ int left=0,right=a.length-1,low=0,high=a[0].length-1; while(low<=high){ for(int i=left;i<=right;i++){//123 System.out.print(a[left][i]+" "); } low++; for(int i=low;i<=high;i++){//69 System.out.print(a[i][right]+" "); } right--; for(int i=right;i>=left;i--){//87 System.out.print(a[high][i]+" "); } high--; for(int i=high;i>=low;i--){//45 System.out.print(a[i][left]+" "); } left++; } }