674. Longest Continuous Increasing Subsequence Easy

@problem@discussion
#Array



1/**
2 * [674] Longest Continuous Increasing Subsequence
3 *
4 * Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasing.
5 * A continuous increasing subsequence is defined by two indices l and r (l < r) such that it is [nums[l], nums[l + 1], ..., nums[r - 1], nums[r]] and for each l <= i < r, nums[i] < nums[i + 1].
6 *  
7 * Example 1:
8 * 
9 * Input: nums = [1,3,5,4,7]
10 * Output: 3
11 * Explanation: The longest continuous increasing subsequence is [1,3,5] with length 3.
12 * Even though [1,3,5,7] is an increasing subsequence, it is not continuous as elements 5 and 7 are separated by element
13 * 4.
14 * 
15 * Example 2:
16 * 
17 * Input: nums = [2,2,2,2,2]
18 * Output: 1
19 * Explanation: The longest continuous increasing subsequence is [2] with length 1. Note that it must be strictly
20 * increasing.
21 * 
22 *  
23 * Constraints:
24 * 
25 * 	1 <= nums.length <= 10^4
26 * 	-10^9 <= nums[i] <= 10^9
27 * 
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/longest-continuous-increasing-subsequence/
32// discuss: https://leetcode.com/problems/longest-continuous-increasing-subsequence/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37    pub fn find_length_of_lcis(nums: Vec<i32>) -> i32 {
38        0
39    }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46    use super::*;
47
48    #[test]
49    fn test_674() {
50    }
51}
52


Back
© 2025 bowen.ge All Rights Reserved.