Python solution - Simple pattern


  • 0
    A
    n = int(len(arr))
    for i in range(n//2):
          for j in range(i, n-i-1):
                t = arr[i][j]
                arr[i][j] = arr[n-j-1][i]
                arr[n-j-1][i] = arr[n-i-1][n-j-1]
                arr[n-i-1][n-j-1] = arr[j][n-i-1]
                arr[j][n-i-1] = t
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.