Easy

Quiz

#594 Longest Harmonious Subsequence

APPROACH

A harmonious array has the property that the difference between its largest and smallest elements equals exactly 1. Given an integer array nums, return the length of the longest harmonious subsequence that can be formed from its elements.

1 of 4
1:00

What is the optimal approach for this problem?