Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
franneck94 committed Jan 29, 2024
1 parent ed71cb5 commit 6852a3b
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions 05_Vector/_Exercise/Exercise/exercise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,11 @@
// Exercise 2
VectorT max_row_values(MatrixT &matrix)
{
auto row_max_vec = VectorT(matrix.size(), 0.0);
if (!matrix.size() || !matrix[0].size())
return row_max_vec;

for (std::size_t i = 0; i != matrix.size(); ++i)
{
auto act_row_max = matrix[i][0];

for (std::size_t j = 1; j != matrix[i].size(); ++j)
{
if (matrix[i][j] > act_row_max)
{
act_row_max = matrix[i][j];
}
}

row_max_vec[i] = act_row_max;
}

return row_max_vec;
}

// Exercise 3
ValueT sort_and_max(VectorT &vec)
{
std::sort(vec.begin(), vec.end());

return vec.back();
}

0 comments on commit 6852a3b

Please sign in to comment.