Permalink
Browse files

fix three_vec bug (reddit code review)

  • Loading branch information...
nathanleclaire committed Oct 27, 2013
1 parent 3d18d5b commit 794993e01b1e0fa6154c722c4d74009b02cdef45
Showing with 2 additions and 1 deletion.
  1. +2 −1 indices_sum_to_zero/indices_sum_to_zero.cc
@@ -51,7 +51,7 @@ void print_my_vector(const vector<int>& v)

vector<int> three_vec(int i, int j, int k)
{
static const int arr[] = {i, j, k};
int arr[] = {i, j, k};
vector<int> indices (arr, arr + sizeof(arr) / sizeof(arr[0]));
return indices;
}
@@ -128,6 +128,7 @@ vector<int> three_indices_that_sum_to_zero_suave(vector<int> v)
sum = sum_from_value_index_vec(value_index_vec, i, j, k);
if (sum == 0)
{
cout << "The elements: " << value_index_vec.at(i).value << " " << value_index_vec.at(j).value << " " << value_index_vec.at(k).value << endl;
return three_vec(value_index_vec.at(i).index, value_index_vec.at(j).index, value_index_vec.at(k).index);
}

0 comments on commit 794993e

Please sign in to comment.