My issue
My first all 3 test cases are passed but hidden test cases are fail help me in these where my approach went wrong
My code
#include <bits/stdc++.h>
using namespace std;
void test(){
int n;cin>>n;
vector<int>a(n);
int sum=0;
for(int i=0;i<n;i++){
cin>>a[i];
sum+= abs(a[i]);
}
cout<<sum<<endl;
}
int main() {
int testCases;
cin >> testCases;
while (testCases--) {
test();
}
return 0;
}
Problem Link: Maximise Sum Practice Coding Problem