human
Can you provide a code to count pair of strings whose concatenation has every vowel and the other steps required given the following:
Count pair of strings whose concatenation has every vowel | Function to return the count of all concatenated string with each vowel at least once.
Creating a hash array with initial value as 0.
Traversing through each string and getting hash value for each of them.
Initializing the weight of each string.
Find the hash value for each string.
Increasing the count of the hash value.
Getting all possible pairs of indexes in hash array.
Check if the pair which has hash value 31 and multiplying the count of string and add it strCount.
Corner case , for strings which independently has all the vowels.
Return thre final count.
Given array of strings ;"
Solution in Python:
assistant
#Here is code to count pair of strings whose concatenation has every vowel and the other steps required.
 def good_pairs ( Str , N ) :
	arr = [ 0 for i in range ( 32 ) ]
	strCount = 0
	for i in range ( N ) :
		Weight = 0
		for j in range ( len ( Str [ i ] ) ) :
			switcher = { ' a ' : 1 , ' e ' : 2 , ' i ' : 4 , ' o ' : 8 , ' u ' : 16 , }
			Weight = Weight | switcher . get ( Str [ i ] [ j ] , 0 )
		arr [ Weight ] += 1
	for i in range ( 32 ) :
		for j in range ( i + 1 , 32 ) :
			if ( ( i j ) == 31 ) :
				strCount += arr [ i ] * arr [ j ]
	strCount += int ( ( arr [ 31 ] * ( arr [ 31 ] - 1 ) ) / 2 )
	return strCount
Str = [ " aaweiolkju " , " oxdfgujkmi " ]
N = len ( Str )
/ * Function call * /
print ( good_pairs ( Str , N ) )