Computer Science, asked by navee6rnk, 1 month ago

given an array Arr[] of integer numbers have size N Task is to find out single or consecative numbers from Arr[] with sum 0 when found print "1" otherwise​

Answers

Answered by pranjal4466
0

Explanation:

Input: {4, 2, -3, 1, 6}

Input: {4, 2, -3, 1, 6}Output: true

Input: {4, 2, -3, 1, 6}Output: true Explanation:

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}Output: true

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}Output: true Explanation:

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 2 to 2.

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 2 to 2.Input: {-3, 2, 3, 1, 6}

Input: {4, 2, -3, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 1 to 3.Input: {4, 2, 0, 1, 6}Output: true Explanation:There is a subarray with zero sum from index 2 to 2.Input: {-3, 2, 3, 1, 6}Output: false

Answered by bhanusrivallir2
0

Explanation:

in example,the number list is 6,-2,3,-1.here(-2) +3 +(-1) =0.so we can get consecutive numbers in Arr[] and its sum is 0.hence the output is 1.in example-2,the numbers list is 5,1,2,3,-4.any consecutive numbers cannot give 0 sum.hence the output is 0

Similar questions