JAVA_LeetCode 3392_Count Subarrays of Length Three With a Condition 풀이 class Solution { public int countSubarrays(int[] nums) { // 중간값이 양 값 합의 2배일경우 체크한다. int res = 0, len = nums.length; for(int i = 1; i < len - 1; i++){ if(nums[i] == (nums[i - 1] + nums[i + 1]) * 2) res++; } return res; } } * 출처 https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition...
JAVA_LeetCode 3392_Count Subarrays of Length Three With a Condition에 대한 요약내용입니다.
자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.