human
Count number of triplets with product equal to given number | Set 2 | Function to count such triplets.
Sort the array.
three pointer technique.
Calculate the product of a triplet.
Check if that product is greater than m , decrement mid.
Check if that product is smaller than m , increment start.
Check if that product is equal to m , decrement mid , increment start and increment the count of pairs.
Drivers code"
Solution in Python:

=====
Can you provide a code to count number of triplets with product equal to given number and the other steps required?
assistant
#Here is code to count number of triplets with product equal to given number and the other steps required.
 def countTriplets ( arr , n , m ) :
	count = 0
	arr . sort ( )
	for end in range ( n - 1 , 1 , - 1 ) :
		start = 0
		mid = end - 1
		while ( start < mid ) :
			prod = ( arr [ end ] * arr [ start ] * arr [ mid ] )
			if ( prod > m ) :
				mid -= 1
			elif ( prod < m ) :
				start += 1
			elif ( prod == m ) :
				count += 1
				mid -= 1
				start += 1
	return count
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 1 , 1 , 1 , 1 , 1 ]
	n = len ( arr )
	m = 1
	print ( countTriplets ( arr , n , m ) )