The function takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A, that is, elements in the counter-diagonal (going from the bottom left corner, up and to the right) and elements that are to the right of it. For example, if the input is [1 2; 3 4; 5 6; 7 8], then the function would return 21.
eleni-chr / halfsum Goto Github PK
View Code? Open in Web Editor NEWTakes a 1-D or 2-D array and computes the sum of the elements of it that are in the lower right triangular part of it, that is, elements in the counter-diagonal and elements that are to the right of it.
License: MIT License