#include <vector>

int positive_sum (const std::vector<int> arr){

  // Your code here

  int sum = 0;

  for(int i = 0; i < arr.size(); i++){

    if(arr[i] > 0){

      sum += arr[i];



  return sum;



For this problem I had to review how to find the size of a vector. This was found on the following site:


After looping through all the elements, the code needed to sum all the positive values. When the loop was finished the sum was returned by the function.

All in all, the problem did not cause me too much trouble and it was a very straightforward problem.