Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

The minimum sum of a 2d array.

Revision en2, by ZZEZ73, 2020-04-28 10:40:47

i am having a hard time making a code that find the the minimum sum of a matrix. But the catch is that you can only choose one from each row. example input would be :

3
1 8 5
9 2 5
10 7 6

and the output being:

9 10 12.

explanation would be that INT N is given and it makes a matrix of N*N and you must make a program that find the lowest sum of elements of a row. 9=1+2+6 10=1+2+7 12=1+5+6 I tried to brute force it by finding the sum of all the sums but that turned out to be a huge bust. Could any of you help me find a way to find this code because I am stumped.

Tags c++, #math, #array, #algorithms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ZZEZ73 2020-04-28 10:40:47 47 Tiny change: 'tumped. \n\n' -> 'tumped. \n`dawdsd`\n'
en1 English ZZEZ73 2020-04-28 10:14:14 620 Initial revision (published)