//一破题付出血的代价   多思考!
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++; } }

 

相关文章:

  • 2021-06-25
  • 2021-07-19
  • 2021-08-04
  • 2021-07-03
  • 2021-08-06
猜你喜欢
  • 2022-02-18
  • 2021-07-18
  • 2022-12-23
  • 2022-01-07
  • 2021-08-17
  • 2022-12-23
  • 2021-04-10
相关资源
相似解决方案