Subarray Sum Equals K

Medium · Hashing · about 20 minutes

Asked at Amazon, Google, Meta, PayPal, Visa, Capital One, Chime, SoFi, Affirm, Klarna, American Express.

The array may hold negative numbers as well as positive ones. Count the contiguous slices whose values total exactly k.

Related guides