I am experimenting with different array sizes and elements. For simplicity I'm taking an array of size: 3x3. In a form of 2D list as follows:
input_matrix = [[80,81,84],[69,80,51],[13,37,65]]
So, what might be a best way to do it? If I use nested loops, that would be an overkill to such simple task with O(n^2) complexity which I want to avoid.
EDIT 1:
By Sum maximization I meant that I can swap elements within the array and for each arrangement in first row there would be a different sum. So how many swaps do I need to get that arrangement for which the sum of the rows is maximum of all the possible sums that can be achieved by putting elements from whole array into the first row