//
//  main.cpp
//  Longest Increasing Subsequence (LIS)
//
//  Created by Himanshu on 17/09/21.
//

#include <iostream>
using namespace std;
const int N = 8;

void LIS (int A[]) {
    int LIS[N], sol = 1;
    
    
    for (int i=0; i<N; i++) {
        LIS[i] = 1;
        for (int j=0; j<i; j++) {
            if (A[i] > A[j] && LIS[i] < LIS[j]+1) {
                LIS[i] = LIS[j] + 1;
            }
        }
        sol = max(sol, LIS[i]);
    }
    
    cout<<"Length of Longest Increasing Subsequence (LIS) is: "<<sol<<endl;
    
}
 
int main() {
    int A[N] = {10,9,2,5,3,7,101,18};
    LIS(A);
}
