Search⌘ K
AI Features

Solution: Longest Harmonious Subsequence

C# solution for the Longest Harmonious Subsequence problem using the Hash Maps pattern.

Statement

Given an integer array nums, return the length of the longest harmonious subsequence of nums.

A subsequence is formed by deleting zero or more elements from nums without changing the relative order of the remaining elements. A subsequence is called harmonious if the difference between its maximum value and minimum value is exactly 11.

If no harmonious subsequence exists, return ...