Question:
Find all triplets with zero sum
We need to find all triplets of zero sum in the given array
For Example:
def Triplets(arr, n):
res = True
for i in range(0, n-2):
for j in range(i+1, n-1):
for k in range(j+1, n):
if (arr[i] + arr[j] + arr[k] == 0):
print(arr[i], arr[j], arr[k])
res = True
if (res == False):
print(" not exist ")
arr = [0, -1, 2, -3, 1]
n = len(arr)
Triplets(arr, n)