#3392

Count Subarrays of Length Three With a Condition

easy · 61.5% accepted · 301 likes · top 62%

array

Description

Given an integer array nums, return the number of subarrays of length 3 such that the sum of the first and third numbers equals exactly half of the second number.

Solution