Longest subrray with sum k


this code isn;t working for the below test case:
10 3
1 2 3 -3 -2 -1 4 1 0 1
can u please explain me the problem with the code?

hello @Sagarjha07
image
update s[pre] only when key pre is not there in ur map.

pls refer this code-> https://ide.codingblocks.com/s/230806