06
Jan
2020

Hackerrank A Very Big Sum (C++)

C++:

long aVeryBigSum(vector<long> ar) {
    long result = 0;
    for(int i = 0; i < ar.size(); i++){
        result += ar[i];
    }
    return result;
}

Explanation:

Just summing up the value of each vector and adding it to result. At the end, return result.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *