@@ -0,0 +1,824 @@
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0Apublic class LeetCode0594 %7B%0A%0A    public int findLHS(int%5B%5D nums)%0A    %7B%0A%0A        if (nums == null %7C%7C nums.length == 0) %7B%0A            return 0;%0A        %7D%0A%0A        Map%3CInteger, Integer%3E map = new HashMap%3CInteger, Integer%3E();%0A%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            map.put(nums%5Bi%5D, map.getOrDefault(nums%5Bi%5D, 0) + 1);%0A        %7D%0A%0A        int result = 0;%0A%0A        for (int key : map.keySet()) %7B%0A            if (map.containsKey(key + 1)) %7B%0A                result = Math.max(result, map.get(key + 1) + map.get(key));%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        LeetCode0594 leetcode = new LeetCode0594();%0A        System.out.println(leetcode.findLHS(new int%5B%5D %7B 1, 3, 2, 2, 5, 2, 3, 7 %7D));%0A    %7D%0A%7D

Add LeetCode0594.java