← ALL NOTES
Array

594. Longest Harmonious Subsequence

A "harmonious" sequence has max − min exactly 1, meaning it contains only two adjacent values x and x+1, both present. Find the longest such subsequence. Since order doesn't matter for a…

Loading…