My issue
This is my code, the outputs are correct but on submitting it gives wrong answer at task 2. Can someone please point out the error.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int tests; cin >> tests;
while( tests > 0 ){
tests = tests - 1;
int num; cin >> num;
int arr[num]; int l=0;
for (int i=0; i<num; i++){
cin >> arr[i];
}
for (int i=1;i<num; i++){
if (arr[i]>arr[i-1]){
l=i;
}
else{
l=i-1;
}
}
cout << l << endl;
}
}
Problem Link: Degree of Polynomial Practice Coding Problem - CodeChef