What's wrong in the code why does it not passes all the testcases

#include
using namespace std;
int increasingDecreasingSequence(int n) {
bool isDecreasing = 1;
int prev = n;
for(int i = 1; i < n; i++) {
int curr = n;
if(curr == prev)
return 0;
else if (curr > prev)
isDecreasing = 0;
else if(!isDecreasing && curr < prev)
return 0;
prev = curr;
}
return 1;
}
int main() {
int x;
cin>>x;
int n;
int count = 0;
while(x-- != 0)
{
cin >> n;

	if(increasingDecreasingSequence(n) == 1)
		count++;
	
}
if(count > 0)
	cout<<"true";
else
	cout<<"false";
return 0;

}

hello @nitinchoudhary260

check now->

a) u were calling function x times,instead u have to call it only once

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.