Count Subarrays with a Target Sum
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: Count contiguous subarrays whose sum equals a target in O(n) time, even when values are negative or zero. Use prefix-sum frequencies to count valid starts, including subarrays that begin at index zero.
Read the full Meta Software Engineer interview experience this question came from