When summit this code it showed that my is not running correctly in test case :- 0,2 &6. But when I checked running my code manually on these test cases it showed the correct output.
Please help!!
My code is written below :-
#include
using namespace std;
int main() {
int n,d=1, ans=0;
long int noc, nop = noc;
cin>>n;
for(int i=0; i<n; i++)
{
if(i != 0)
{
cin>>noc;
if(noc==nop)
{
ans = 1;
goto out;
}
else if(noc>nop)
d=0;
else if(d==0 and noc<nop)
{
ans = 2;
goto out;
}
}
nop = noc;
}
out :
if(ans == 1 or ans == 2)
cout<<"false"<<endl;
else if(ans ==0)
cout<<"true"<<endl;
return 0;
}