Simple Array Sum

Sort by

recency

|

3396 Discussions

|

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/b7KAvErmVIw

    int simpleArraySum(vector<int> ar) {
        int sum = 0;
        for(int i = 0; i < ar.size(); i++){
            sum += ar[i];
        }
        return sum;
    }
    
  • + 0 comments

    It's my solution in C++ but it's not working don't know why

    int simpleArraySum(vector ar) { int ans = 0; int size = sizeof(ar) / sizeof(ar[0]); for(int i=0; i

  • + 2 comments

    here is my python code for the given problem

    def simpleArraySum(ar):
        sum=0
        for i in ar:
            sum=sum+i
            i=i+1
        return sum
    
  • + 0 comments

    solved

  • + 0 comments

    solved