• + 1 comment

    i cant pass some test cases, those with very long inputs, i dont know what to do! here is my code: -

    long arrayManipulation(long long int n, vector> queries) {

    vector<long long int> v;
    vector<long long int>v2;
    long long int max;
    
    for(long long int i=0;i<n;i++){
        v.push_back(0);
    }
    for(long long int i=0;i<queries.size();i++){
    
        for(long long int j=0;j<queries[i].size();j++){
            v2.push_back(queries[i][j]);
        }
    
       for(long long int k=(v2[0]-1);k<v2[1];k++){
           if(v[k]!=0){
               v[k]+=v2[2];
           }
           else{
               v[k]=v2[2];
           }
        }
        v2.pop_back();
        v2.pop_back();
        v2.pop_back();
    }
    
    max=*max_element(v.begin(), v.end());
    return max;
    

    }