Dsa
Hashing
Easy
Subarray Zero Sum Checker
Given an array of integers, determine if there exists a contiguous subarray whose sum is zero.
Input Format:
The first line will contain an integer n - the size of the array.
The second line contains n space-separated integers which are the elements of the array.
Output Format:
Print 'Yes' if such a subarray exists, otherwise print 'No'.
Example:
Input:
5
1 2 -3 1 2
Output:
Yes
Key concepts
hashingsubarraysprefix sums
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now