I wrote the following code to walk half the diagonals of an array:
String[][] b = [a,b,c]
[d,e,f]
[g,h,i];
public void LoopD
Type 1: We can solve this using python very easily
Code:
r,c=map(int,input().split())
mat=[[str(ch) for ch in input().split()]for _ in range(r)]
for i in range(r*c-2):
lis=[]
for j in range(r):
for k in range(c):
if k+j==i:
lis.append(mat[j][k])
print(*lis[::-1])
Output:
5 5
a b c d e
f g h i j
k l m n o
p q r s t
u v w x y
a
f b
k g c
p l h d
u q m i e
v r n j
w s o
x t
y