Please check my code for Maximum Bitonic Subarray

#include
using namespace std;

int main(){
int t, k;
cin >> t;
while (t > 0){
int n, a[n];
cin >> n;

    for (int i = 0; i < n; i ++){
        cin >> a[i];
    }
}


k = sizeof(a)/sizeof(a[0]);
bitonic(a, k);
return 0;

}

int bitonic(int a[], int k){
int inc[k], dec[k], i, max;
inc[0] = 1;
dec[k-1] = 1;

for (int i = 1; i < k; i++)
inc[i] = (a[i] >= a[i-1])? inc[i-1] + 1: 1; 

for (i = k-2; i >= 0; i--) 
dec[i] = (a[i] >= a[i+1])? dec[i+1] + 1: 1;  

max = inc[0] + dec[0] - 1;  
for (i = 1; i < k; i++)
    if (inc[i] + dec[i] - 1 > max)  
        max = inc[i] + dec[i] - 1;  
        return max;  

}

@adityakaunhai
hello aditya ,
u need to print output for each test case

a)first read a number t( number of test cases)
b) run a loop for t times

  • In each iteration read n number of inputs ,then n more numbers

  • and then call ur bitonic function on this n number and print output

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.