Given an unsorted array of integers, find the length of longest continuous
increasing subsequence (subarray).
My method:
int findLengthOfLCIS(int* nums, int numsSize) {
int i, j, k, cmp;
int ct = 1;
if (numsSize == 0) {
return 0;
}
for (i = 0; i < numsSize - 1;) {
k = 1;
for (cmp = nums[i], j = i + 1; j < numsSize && nums[j] > nums[j - 1]; j++) {
k++;
}
ct = k > ct ? k : ct;
i = j;
}
return ct;
}
36 / 36 test cases passed. | Status: Accepted |
Runtime: 4 ms | Submitted: 1 minute ago |