Question: 
Write a function to find if there is a triplet in the array whose sum is equal to a given value.


Model's Code:
def find_triplet_array(arr, n, x):
    arr.sort()
    for i in range(n - 2):
        l, r = i + 1, n - 1
        while l < r:
            current_sum = arr[i] + arr[l] + arr[r]
            if current_sum == x:
                return (arr[i], arr[l], arr[r])
            elif current_sum < x:
                l += 1
            else:
                r -= 1
    return None



Sample Correct Code:
def find_triplet_array(A, arr_size, sum): 
	for i in range( 0, arr_size-2): 
		for j in range(i + 1, arr_size-1): 
			for k in range(j + 1, arr_size): 
				if A[i] + A[j] + A[k] == sum: 
					return  A[i],A[j],A[k] 
					return True
	return False


Asserts:
assert find_triplet_array([1, 4, 45, 6, 10, 8], 6, 22) == (4, 10, 8)
assert find_triplet_array([12, 3, 5, 2, 6, 9], 6, 24) == (12, 3, 9)
assert find_triplet_array([1, 2, 3, 4, 5], 5, 9) == (1, 3, 5)


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 916 of 974: 704/916 (76.85589519650655%): failed