FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 3685,3 "name": "count_subarrays_of_length_three_with_a_condition",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition/",6 "date": "2024-12-07 00:00:00",7 "task_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. **Example 1:** **Input:** nums = [1,2,1,4,1] **Output:** 1 **Explanation:** Only the subarray `[1,4,1]` contains exactly 3 elements where the sum of the first and third numbers equals half the middle number. **Example 2:** **Input:** nums = [1,1,1] **Output:** 0 **Explanation:** `[1,1,1]` is the only subarray of length 3. However, its first and third numbers do not add to half the middle number. **Constraints:** `3 <= nums.length <= 100` `-100 <= nums[i] <= 100`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,2,1,4,1]",12 "output": "1 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,1,1]",17 "output": "0 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 24,24 78,25 -95,26 86,27 33,28 26,29 85,30 -52,31 5,32 92,33 -31,34 -85,35 1,36 -62,37 -15,38 43,39 -1,40 9,41 12,42 -89,43 -72,44 -14,45 95,46 6947 ],48 "output": 049 },50 {51 "input": [52 -96,53 -49,54 76,55 -55,56 -29,57 28,58 -65,59 9,60 -17,61 45,62 59,63 64,64 -44,65 20,66 -23,67 -77,68 87,69 -74,70 -49,71 -77,72 -23,73 73,74 -65,75 22,76 -93,77 91,78 -72,79 -24,80 -32,81 -6,82 -15,83 -43,84 -100,85 80,86 12,87 -56,88 -15,89 -19,90 -52,91 -29,92 -33,93 93,94 12,95 -34,96 -39,97 47,98 -17,99 2,100 -26,101 -88,102 53,103 -66,104 84,105 15,106 62,107 -60,108 98,109 -91,110 20,111 -89,112 -13,113 -70,114 -70115 ],116 "output": 0117 },118 {119 "input": [120 92,121 -67,122 -52,123 -20,124 -96,125 -5,126 -3,127 70,128 -1,129 -5,130 71,131 -59,132 89,133 -88,134 -57,135 -58,136 7,137 -46,138 15,139 -19,140 -2,141 53,142 13,143 -15,144 -48,145 -24,146 -15,147 -5,148 67,149 -53,150 13,151 41,152 89,153 -99,154 -19,155 -48,156 -26,157 91158 ],159 "output": 0160 },161 {162 "input": [163 -67,164 66,165 57,166 64,167 59,168 -47,169 -44,170 -85,171 -78,172 63,173 27,174 89,175 46,176 50177 ],178 "output": 0179 },180 {181 "input": [182 35,183 -60,184 20,185 10,186 86,187 -9,188 83,189 -26,190 -26,191 -34,192 -98,193 -22,194 -90,195 64,196 99,197 70,198 66,199 -31,200 -78,201 -29,202 -63,203 -25,204 44,205 39,206 -24,207 86,208 34,209 53,210 61,211 36,212 12213 ],214 "output": 0215 }216 ],217 "haskell_template": "countSubarrays :: [Int] -> Int\ncountSubarrays nums ",218 "ocaml_template": "let countSubarrays (nums: int list) : int = ",219 "scala_template": "def countSubarrays(nums: List[Int]): Int = { \n \n}",220 "java_template": "class Solution {\n public int countSubarrays(int[] nums) {\n \n }\n}",221 "python_template": "class Solution(object):\n def countSubarrays(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "222}