Skip to content

Files

Latest commit

 

History

History
15 lines (13 loc) · 446 Bytes

0048. Rotate Image.md

File metadata and controls

15 lines (13 loc) · 446 Bytes

Screen Shot 2022-08-22 at 23 23 13

var rotate = function(matrix) {
  for(let i=0;i<matrix.length;i++){
      for(let j=i+1;j<matrix[i].length;j++){
          [matrix[i][j], matrix[j][i]] = [matrix[j][i], matrix[i][j]];
      }
  }
  for(let i=0;i<matrix.length;i++){
      matrix[i].reverse()
  }  
};