int n;//input size of array
cin >> n;
vector <int> a(n);
vector <int> in;
for (int i = 0; i < n; i++)
cin >> a[i];//input array elements
if (n == 1) {
cout << "1" << "\n";
return 0;
}
for (int i = 1; i <= n ; i++)//to get longest incresing subsequence in the array
{
int flag = 0, j = i;
while (j < n && a[j] >= a[j - 1] ) {
j++;
flag …Run Code Online (Sandbox Code Playgroud)