Skip to content

Commit 4e5d866

Browse files
author
deepak.panwar
committed
Longest subarray with sum-k problem solved
1 parent ed86f86 commit 4e5d866

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/array/algo_company/leetcode/LongestSubArrayWithSumK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private static int maxLenLongestKSumSubarray(int[] arr, int k) {
6969
}
7070
// Case 2: (sum - k) seen before
7171
if (map.containsKey(sum - k)) {
72-
maxLength = Math.max(maxLength, i - -map.get(sum - k));
72+
maxLength = Math.max(maxLength, i - map.get(sum - k));
7373
} else {
7474
map.put(sum, i);
7575
}

0 commit comments

Comments
 (0)