-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrotatedarray.py
More file actions
37 lines (32 loc) · 778 Bytes
/
rotatedarray.py
File metadata and controls
37 lines (32 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def transposed(arr):
transposed=[]
n=len(arr)
m=len(arr[0])
for j in range(m):
a=[]
for i in range(n):
a.append(arr[i][j])
transposed.append(a)
return transposed
# def reverse_row(arr):
# for i in range(len(arr)):
# arr[i]=arr[i][::-1]
# return arr
# def rotate(arr):
# n=len(arr)
# m=len(arr[0])
# rotate=[]
# for j in range(m):
# a=[]
# for i in range(n-1,-1,-1):
# a.append(arr[i][j])
# rotate.append(a)
# return rotate
# n=int(input())
# m=int(input())
# arr=[[int(input()) for i in range(m)] for j in range(n)]
# # arr=list(map(int,input().split(' ')))
# print(arr)
# print(rotate(arr))
# # print(reverse_row(arr))
# print(transposed(arr))