Validate Subsequence Time : O(min(n, m)) where n is size of array, m is size of sequence Space : O(1) 12345678910using namespace std;bool isValidSubsequence(vector<int> array, vector<int> sequence) { int j = 0; for(int i = 0; i < array.size() and j < sequence.size(); i++) { if(array[i] == sequence[j]) j++; } return j == sequence.size();}