diff --git a/Subarray sum equals k.java b/Subarray sum equals k.java new file mode 100644 index 00000000..e69de29b diff --git a/contiguous array.java b/contiguous array.java new file mode 100644 index 00000000..aa07d09d --- /dev/null +++ b/contiguous array.java @@ -0,0 +1,24 @@ +// TimeComplexity: O(n) +// SpaceComplexity: O(n) +// Did this code successfully run on Leetcode : yes +// Any problem you faced while coding this : no + +class Solution { + public int findMaxLength(int[] nums) { + int max = 0; + int sum = 0; + HashMap map = new HashMap<>(); + map.put(0,-1); + for(int i=0; i