public static int LIS(List<Integer> al) { int[] arr = new int[al.size()]; int lis = 0; arr[0] = 1; for (int i = 1; i < al.size(); i++) { if (al.get(i) > al.get(i - 1)) arr[i] = arr[i - 1] + 1; else arr[i] = 1; } for (int i : arr) { if (arr[i] > lis) lis = arr[i]; } return lis; }