Sponsored
Solve with full IDE support and test cases
Use these hints if you're stuck. Try solving on your own first.
Brute force all the possible subarrays and find the longest that satisfies the conditions.