When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
15 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
int Min(int col, int row, int sum)
{
if (col >= n)
return sum;
if (row >= n)
return sum;
int bruh1 = v[col + 1][row];
int bruh2 = v[col][row + 1];
return min(Min(col + 1, row, sum + bruh1), Min(col, row + 1,sum + bruh2));
}```
is this same as
int Min(int col, int row, int sum)
{
if (col >= n)
return sum;
if (row >= n)
return sum;
return min(Min(col + 1, row, sum + v[col][row]), Min(col, row + 1,sum + v[col][row]));
}```
its not, right?
I mmean looks like it?
wait no it's not
I missed the +1 in the one above
in general that line is super hard to read
expecially cause you are using min and Min and it's a long line
in order for second code to do same as first one does
i should just add sum + v[col + 1][row] and sum + v[col][row + 1]??
int Min(int col, int row, int sum)
{
if (col >= n)
return sum;
if (row >= n)
return sum;
int a = Min(col + 1, row, sum + v[col][row];
int b = Min(col, row + 1,sum + v[col][row]);
return std::min(a,b));
}
just write it like this for example, 10x more clear
!solved