본문 바로가기
Problem Solving/LeetCode

[LeetCode] 674. Longest Continuous Increasing Subsequence - Java

by graycode 2026. 9. 21.

• 문제 링크

 

Longest Continuous Increasing Subsequence - LeetCode

Can you solve this real interview question? Longest Continuous Increasing Subsequence - Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasin

leetcode.com

 

• 풀이 코드

public class Solution {

    public int findLengthOfLCIS(int[] nums) {
        int max = 1, cur = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i - 1] < nums[i]) max = Math.max(max, ++cur);
            else cur = 1;
        }

        return max;
    }

}

댓글