code is giving wrong output in test case 1.
@Ajitverma1503 Change line number 10 to if(a[0] <= a[1] && sorted(a+1,n-1)) and then check.