Daily challenge for 2025-12-17
351. Longest Harmonious Subsequence
A harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.
Given an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences.
A subsequence is a sequence derived by deleting some or no elements without changing the order of the remaining elements.
Example:Input: nums = [1,3,2,2,5,2,3,7]Output: 5
Explanation: The longest harmonious subsequence is [3,2,2,2,3].
Run this challenge interactively in Python or JavaScript when the app loads.