Easy

Quiz

#594 Longest Harmonious Subsequence

APPROACH

We define a harmonious array as 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.

1 of 4

What is the optimal approach for this problem?