{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"livecodebench","formal_name":"LiveCodeBench","introduction":"LiveCodeBench continuously collects new competitive-programming problems to evaluate coding capabilities. Its initial release_v1 contains 400 problems, with source platform, contest date, and dataset version tracked explicitly.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://livecodebench.github.io/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"d7d781a3-28db-5dad-9be9-8182db365f7d","task_key":"release~5fv1--test--2866","task_revision_id":"2","upstream_id":"2866","short_description":"longest-even-odd-subarray-with-threshold","config":"release_v1","split":"test","body":"{\"contest_date\":\"2023-07-02T00:00:00\",\"contest_id\":\"weekly-contest-352\",\"difficulty\":\"easy\",\"platform\":\"leetcode\",\"question_content\":\"You are given a 0-indexed integer array nums and an integer threshold.\\nFind the length of the longest subarray of nums starting at index l and ending at index r (0 <= l <= r < nums.length) that satisfies the following conditions:\\n\\nnums[l] % 2 == 0\\nFor all indices i in the range [l, r - 1], nums[i] % 2 != nums[i + 1] % 2\\nFor all indices i in the range [l, r], nums[i] <= threshold\\n\\nReturn an integer denoting the length of the longest such subarray.\\nNote: A subarray is a contiguous non-empty sequence of elements within an array.\\n \\nExample 1:\\n\\nInput: nums = [3,2,5,4], threshold = 5\\nOutput: 3\\nExplanation: In this example, we can select the subarray that starts at l = 1 and ends at r = 3 => [2,5,4]. This subarray satisfies the conditions.\\nHence, the answer is the length of the subarray, 3. We can show that 3 is the maximum possible achievable length.\\nExample 2:\\n\\nInput: nums = [1,2], threshold = 2\\nOutput: 1\\nExplanation: In this example, we can select the subarray that starts at l = 1 and ends at r = 1 => [2]. \\nIt satisfies all the conditions and we can show that 1 is the maximum possible achievable length.\\n\\nExample 3:\\n\\nInput: nums = [2,3,4,5], threshold = 4\\nOutput: 3\\nExplanation: In this example, we can select the subarray that starts at l = 0 and ends at r = 2 => [2,3,4]. \\nIt satisfies all the conditions.\\nHence, the answer is the length of the subarray, 3. We can show that 3 is the maximum possible achievable length.\\n\\n \\nConstraints:\\n\\n1 <= nums.length <= 100 \\n1 <= nums[i] <= 100 \\n1 <= threshold <= 100\",\"question_title\":\"longest-even-odd-subarray-with-threshold\",\"starter_code\":\"class Solution:\\n    def longestAlternatingSubarray(self, nums: List[int], threshold: int) -> int:\\n        \"}","display_format":"text","language":"","answer_status":"external_grader","assets":[],"source_url":"https://livecodebench.github.io/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}