In this instance, I will utilize Python to address the issue. def zero_sum_subarray_exists ( arr ) : # initialize sum of elements sum = 0 # create an empty set to store sum of elements of each subarray s = set ( ) for i in range ( len ( arr ) ) : sum += arr [ i ] # If sum is zero, or it is already present in set, return true if sum == 0 or sum in s : return True # insert sum into set s . add ( sum ) # No subarray with zero sum exists return False # driver code to test above function arr = [ 4 , 2 , - 3 , 1 , 6 ] print ( zero_sum_subarray_exists ( arr ) ) # prints: True In this example, we generate a set and for each element in the array, we add it to the current sum. If the sum equals zero or this sum has already been encountered, it indicates the presence of a zero-sum subarray, and we return true. If we complete the iteration over the array without identifying any zero-sum subarray, we return false.