Daily challenge for 2026-08-09
586. Longest Alternating Sign Run
Given an array of non-zero integers nums, find the length of the longest contiguous subarray where the signs of adjacent elements alternate (i.e., positive followed by negative, or negative followed by positive).
Example:Input: nums = [1, -1, 2, 3, -4]Output: 3
Explanation: The subarray [1, -1, 2] has alternating signs (+, -, +) and has a length of 3.
Run this challenge interactively in Python or JavaScript when the app loads.