Sorted Array using recursion

#include
using namespace std;

bool sorted(int arr[], int n)
{
if (n == 0 || n == 1)
return true;

if(arr[0] < arr[1] and sorted(arr+1,n-1))
		return true;
	
return false;

}
int main() {
int n ;

int arr[1000000];

cin >> n;
if (n < 1000)
{	
	for (int i =0 ; i <n ; i++)
	{
		cin >> arr[i];
	}
	bool num=sorted(arr,n);
	if(num == true)
		cout << "true";
	else 
		cout << "false";
}
return 0;

}

Please advise one of the test case is getting failed.

hello @chellapandiyan

use <= in place of <

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.