Untitled
Anonymous
plain_text
01/16/2025 3:48 PM
276 B
12
Indexable
fn(nums,k)
{
map.put(0,1);
for(i=0;i<n;i++)
{
psum += arr[i];
rem_sum = psum - k;
cnt += map.get(rem_sum);
map.put(psum,map.getOrDefault(psum,0) + 1);
}
return cnt;
}Editor is loading...
Leave a Comment