
public class MaxSeq {public static void main(String[] args) {System.out.println(findLength(new int[]{1,2,3,3,4,2,5,6,7,8,9}));}private static int findLength(int[] nums) {if (null == nums || nums.length == 0) return 0;if (nums.length == 1) return 1;// 定义初始的一个指针位置int start = 0;// 定义子数组的长度变量int max = 0;for (int i = 1; i < nums.length; i++) {if (nums[i] <= nums[i-1]) {// 移动start的位置start = i;}max = Math.max(max, i - start + 1);}return max;}}
