Skip to main content
Back to problems
#674
Easy Algorithms

Longest continuous increasing subsequence

Array
51.8% acceptance
Feb 20, 2026
2463
195
Given an unsorted array of integers nums, return the length of the longest continuous strictly increasing subsequence (subarray).

Solution

Rust
Time O(n)
Space O(1)
LeetCode
solution.rs
impl Solution {
  pub fn find_length_of_lcis(nums: Vec<i32>) -> i32 {
    if nums.is_empty() { return 0; }
    let mut max_len = 1;
    let mut cur_len = 1;
    for i in 1..nums.len() {
      if nums[i] > nums[i - 1] {
        cur_len += 1;
        max_len = max_len.max(cur_len);
      } else {
        cur_len = 1;
      }
    }
    max_len
  }
}