# Algorithm to find sum of all values in a 2D matrix when i<j [closed]

Given an array A of n integers, output an n by n array B in which B[i,j] (for all i=j values of B[i,j] are left unspecified so ignore that case).

My approach: The most natural way to do this is by having 2 for loops and then filling in all values but that is very inefficient.

How do you design an algorithm which has running time $$O(g(n))$$ where $$\lim_{n \to \infty}\frac{g(n)}{f(n)} = 0$$

New contributor
johanso is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

## closed as unclear what you're asking by David Richerby, D.W.♦Feb 12 at 1:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• You haven't said what the array B is supposed to contain. – David Richerby Feb 12 at 1:03