Ehab has an array a of length n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence?
A sequence a is a subsequence of an array b if a can be obtained from b by deletion of several (possibly, zero or all) elements. The longest increasing subsequence of an array is the longest subsequence such that its elements are ordered in strictly increasing order.
heres my answer, I keep getting "the system cannot find the file specified" whats wrong?
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
int t, n;
cin >> t;
while(t != 0){
cin >> n;
int* a = new int [n];
cin >> a[0];
int min = a[0];
for (int i = 1 ; i < n ; i++){
cin >> a [i];
if (min > a[i])
min = a[i];
}
int* b = new int [n*n];
for (int i = 0 ; i < n*n ; i++)
copy(a[0], b[n-1], b[i*n]);
int num = 0;
for (int i = 0 ; i < n*n ; i++)
if (b[i] == min){
for (int j = i+1 ; j < n*n ; j++){
if (b[j] > b[i]){
num++;
j = i;
}
break;
}
}
cout << num << endl;
t--;
}
}