#include<iostream>
#include<climits>
using namespace std;
int bitonic(int arr[],int n){
int maxlen = 0;
int count = 0;
bool flag = true;
for(int i=0 ; i < n - 1 ; ++i){
if(arr[i] < arr[i+1]){
if(flag == false){
if(arr[i-1] == arr[i]) count = 1;
else count = 0;
flag = true;
}
count++;
}
else if(arr[i] > arr[i+1]){
flag = false;
count++;
}
else{
count++;
}
if(count > maxlen){
maxlen = count;
}
}
return (maxlen+1);
}
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[1000000];
for(int i=0 ; i < n ; ++i){
cin>>a[i];
}
cout<<bitonic(a,n)<<endl;
}
return 0;
}
What is the problem in this code it shows two test case fail ? But all testcases passes in gfg practice with this code
hi @khushmanglani31217_7de9bf16f9c8f286 maybe issue with backend i’ll ask team to check you can proceed if its working on gfg it has far more test cases than here