Help me in solving RATINGINPRAC problem

My issue

include
using namespace std;

void solve();
int main() {
int t;
cin>>t;
while(t–){
solve();
}
}
// your code goes here

void solve(){
int n;
cin>>n;
int A[n];
for(int i=0;i<n;i++){
cin>>A[i];
}
for(int i=0;i<n;i++){
if(A[i+1]<A[i]) {
cout<<“NO”;
return;
}

}
cout<<"YES";

}

this code giving output like this YESYESNONO which is correct for every test case which will enter in the code please someone help me with this how can I resolve it.

My code

#include <iostream>
using namespace std;

void solve();
int main() {
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}
        // your code goes here
       
void solve(){
    int n;
    cin>>n;
    int A[n];
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    for(int i=0;i<n;i++){
        if(A[i+1]<A[i]) {
            cout<<"NO";
           return;
        }
        
    }
    cout<<"YES";
    
}


Learning course: Arrays using C++
Problem Link: Difficulty Rating Order Practice Problem in - CodeChef

@yateet
plzz refer the following code

#include <iostream>
using namespace std;

void solve(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int call;
    call=0;
    for(int i=1;i<n;i++){
        if(arr[i]<arr[i-1]){
         call=1;
         break;
        }
        
    }
    if(call==1){
     cout<<"no"<<'\n';   
    }
    else{
        cout<<"yes"<<'\n';
    }
     
}
int main() {
    int t;
    cin>>t;
    while(t--){
        solve();
        
    }
	// your code goes here
	return 0;
}