I need to calculate array sum, but attribute must be ONLY this particular array.
bool solution(int arr[]) {
int counter = 0;
int len = sizeof(arr) / sizeof(arr[0]);
std::cout << len << std::endl;
for (int i=0; i < len; i++){
counter += arr[i];
}
if (counter == 21)
return true;
return false;
}
It won't work, I need to pass an array length from outside. how to reach this without passing array length as an attribute?