@@ -0,0 +1,833 @@
+// Question: https://leetcode.com/problems/maximum-size-subarray-sum-equals-k%0A%0Apublic class MaximumSizeSubarraySumEqualsK %7B%0A    public int maxSubArrayLen(int%5B%5D nums, int k) %7B%0A        if (nums == null %7C%7C nums.length == 0) %7B%0A            return 0;%0A        %7D%0A%0A        Map%3CInteger, Integer%3E sumToIndex = new HashMap%3C%3E();%0A        sumToIndex.put(0, -1);    // in case the maximum subarray starts from index 0%0A%0A        int sum = 0;%0A        int maxSize = 0;%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            sum += nums%5Bi%5D;%0A            if (!sumToIndex.contains(sum)) %7B%0A                sumToIndex.put(sum, i);%0A            %7D%0A            %0A            Integer prev = sumToIndex.get(sum - k);%0A            if (prev != null) %7B%0A                maxSize = Math.max(maxSize, i - prev);%0A            %7D%0A        %7D%0A%0A        return maxSize;%0A    %7D%0A%7D%0A

Add one solution