FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 3372,3 "name": "longest_strictly_increasing_or_strictly_decreasing_subarray",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/longest-strictly-increasing-or-strictly-decreasing-subarray/",6 "date": "2024-03-31 00:00:00",7 "task_description": "You are given an array of integers `nums`. Return _the length of the **longest** subarray of _`nums`_ which is either **strictly increasing** or **strictly decreasing**_. **Example 1:** **Input:** nums = [1,4,3,3,2] **Output:** 2 **Explanation:** The strictly increasing subarrays of `nums` are `[1]`, `[2]`, `[3]`, `[3]`, `[4]`, and `[1,4]`. The strictly decreasing subarrays of `nums` are `[1]`, `[2]`, `[3]`, `[3]`, `[4]`, `[3,2]`, and `[4,3]`. Hence, we return `2`. **Example 2:** **Input:** nums = [3,3,3,3] **Output:** 1 **Explanation:** The strictly increasing subarrays of `nums` are `[3]`, `[3]`, `[3]`, and `[3]`. The strictly decreasing subarrays of `nums` are `[3]`, `[3]`, `[3]`, and `[3]`. Hence, we return `1`. **Example 3:** **Input:** nums = [3,2,1] **Output:** 3 **Explanation:** The strictly increasing subarrays of `nums` are `[3]`, `[2]`, and `[1]`. The strictly decreasing subarrays of `nums` are `[3]`, `[2]`, `[1]`, `[3,2]`, `[2,1]`, and `[3,2,1]`. Hence, we return `3`. **Constraints:** `1 <= nums.length <= 50` `1 <= nums[i] <= 50`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [1,4,3,3,2]",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "nums = [3,3,3,3]",17 "output": "1 "18 },19 {20 "label": "Example 3",21 "input": "nums = [3,2,1]",22 "output": "3 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 17,29 11,30 42,31 20,32 14,33 23,34 15,35 4,36 3,37 27,38 18,39 12,40 47,41 36,42 39,43 36,44 7,45 4,46 18,47 15,48 32,49 7,50 7,51 19,52 5,53 31,54 16,55 37,56 15,57 19,58 26,59 17,60 19,61 42,62 47,63 47,64 3365 ],66 "output": 467 },68 {69 "input": [70 4,71 41,72 47,73 46,74 12,75 46,76 22,77 9,78 27,79 11,80 41,81 47,82 7,83 21,84 6,85 35,86 48,87 47,88 39,89 30,90 12,91 50,92 36,93 16,94 36,95 23,96 3,97 34,98 21,99 4,100 48,101 11,102 22,103 13,104 27,105 40,106 47,107 46,108 20,109 3,110 4,111 46,112 13,113 50,114 8,115 6116 ],117 "output": 5118 },119 {120 "input": [121 10,122 50,123 10,124 10,125 12,126 48,127 21,128 5,129 7,130 23,131 37,132 29,133 15,134 23,135 28136 ],137 "output": 4138 },139 {140 "input": [141 32,142 6,143 23,144 12,145 49,146 23,147 29,148 33,149 47,150 48,151 7,152 42,153 10,154 13,155 2,156 8,157 11,158 34,159 7,160 3,161 34,162 35,163 10,164 35,165 23,166 29,167 12,168 48,169 41,170 10,171 40,172 30173 ],174 "output": 5175 },176 {177 "input": [178 17,179 29,180 10,181 39,182 14,183 18,184 12,185 3,186 21,187 49,188 16,189 42,190 7,191 13,192 17,193 38,194 2,195 9,196 42,197 22,198 8,199 47,200 1,201 27,202 41,203 16,204 33,205 23,206 16,207 15,208 21,209 22,210 14,211 38,212 29,213 28,214 30,215 15216 ],217 "output": 4218 }219 ],220 "haskell_template": "longestMonotonicSubarray :: [Int] -> Int\nlongestMonotonicSubarray nums ",221 "ocaml_template": "let longestMonotonicSubarray (nums: int list) : int = ",222 "scala_template": "def longestMonotonicSubarray(nums: List[Int]): Int = { \n \n}",223 "java_template": "class Solution {\n public int longestMonotonicSubarray(int[] nums) {\n \n }\n}",224 "python_template": "class Solution(object):\n def longestMonotonicSubarray(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "225}