Skip to main content
deleted 1 character in body
Source Link

Python, 128 bytes (numpy)

(lambda A: (lambda A,S:[[A[U][I-U] for U in range(min(S[1]-1,I),max(I-S[0]+1,0)-1,-1)] for I in range(S[1]+S[0]-1)])(A,A.shape))"

Python, 128 bytes (numpy)

(lambda A: (lambda A,S:[[A[U][I-U] for U in range(min(S[1]-1,I),max(I-S[0]+1,0)-1,-1)] for I in range(S[1]+S[0]-1)])(A,A.shape))"

Python, 128 bytes (numpy)

(lambda A: (lambda A,S:[[A[U][I-U] for U in range(min(S[1]-1,I),max(I-S[0]+1,0)-1,-1)] for I in range(S[1]+S[0]-1)])(A,A.shape))
deleted 189 characters in body
Source Link

Python, 118128 bytes (or 77 bytesnumpy)

Say A is your array

(lambda A,N: (lambda A,MS:[[A[U][I-U] for U in range(max(I-M+1,0),min(NS[1]-1,I)+1)] for I in range(M+N-1)])(A,len(A),len(A and A[0]))

If I am allowed to have A, N, and M as separate variables...

[[A[U][I-U] for U in range(max(I-M+1S[0]+1,0),min(N-1,I)+1-1)] for I in range(M+NS[1]+S[0]-1)])(A,A.shape))"

Python, 118 bytes (or 77 bytes)

Say A is your array

(lambda A,N,M:[[A[U][I-U] for U in range(max(I-M+1,0),min(N-1,I)+1)] for I in range(M+N-1)])(A,len(A),len(A and A[0]))

If I am allowed to have A, N, and M as separate variables...

[[A[U][I-U] for U in range(max(I-M+1,0),min(N-1,I)+1)] for I in range(M+N-1)]

Python, 128 bytes (numpy)

(lambda A: (lambda A,S:[[A[U][I-U] for U in range(min(S[1]-1,I),max(I-S[0]+1,0)-1,-1)] for I in range(S[1]+S[0]-1)])(A,A.shape))"
Source Link

Python, 118 bytes (or 77 bytes)

Say A is your array

(lambda A,N,M:[[A[U][I-U] for U in range(max(I-M+1,0),min(N-1,I)+1)] for I in range(M+N-1)])(A,len(A),len(A and A[0]))

If I am allowed to have A, N, and M as separate variables...

[[A[U][I-U] for U in range(max(I-M+1,0),min(N-1,I)+1)] for I in range(M+N-1)]