Skip to content

Commit

Permalink
add functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysiekFel committed Jan 8, 2024
1 parent e826226 commit 35e3e07
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions homework/max-of-vector/maxOfVector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include <vector>

int maxOfVector(const std::vector<int>& vec) {
// TODO: Implement me :)
return {};
int max_elem = vec[0];
for (const auto& elem : vec) {
if (elem > max_elem) {
max_elem = elem;
}
}
return max_elem;
}

0 comments on commit 35e3e07

Please sign in to comment.