blob: 00ed320463ccbb45a0ef9ca4358b31a8f80448ff (
plain)
1
2
3
4
5
6
7
|
def check_triplet(A, n, sum, count):
if count == 3 and sum == 0:
return True
if count == 3 or n == 0 or sum < 0:
return False
return check_triplet(A, n - 1, sum - A[n - 1], count + 1) or\
check_triplet(A, n - 1, sum, count)
|