• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
December 11, 2023 |1.3K Views

PROBLEM OF THE DAY : 10/12/2023 | Subarray with 0 sum

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddharth Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Array but also build up problem-solving skills.

In this problem, we are given, an array of integers. Find if there is a subarray (of size at least one) with 0 sum. You just need to return true/false depending upon whether there is a subarray present with 0-sum or not. Printing will be taken care by the driver code.

Example :

Input:
n = 5
arr = {4,2,-3,1,6}
Output: 
Yes

Explanation: 
2, -3, 1 is the subarray with sum 0.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/subarray-with-0-sum-1587115621/1