Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays of Length Three With a Condition

med
30 min
Try to solve the Count Subarrays of Length Three With a Condition problem.

Statement

Given an integer array nums, return the number of contiguous subarrays of length 33 such that the sum of the first and third elements is equal to half of the middle element.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • −100≤-100 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays of Length Three With a Condition

med
30 min
Try to solve the Count Subarrays of Length Three With a Condition problem.

Statement

Given an integer array nums, return the number of contiguous subarrays of length 33 such that the sum of the first and third elements is equal to half of the middle element.

Constraints:

  • 3≤3 \leq nums.length ≤100\leq 100

  • −100≤-100 \leq nums[i] ≤100\leq 100