human
Check if all strings of an array can be made same by interchanging characters | Function to check if all strings are equal after swap operations.
Stores the frequency of characters.
Stores the length of string.
Traverse the array.
Traverse each string.
Check if frequency of character is divisible by N.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if all strings of an array can be made same by interchanging characters and the other steps required.
 def checkEqual ( arr , N ) :
	hash = [ 0 ] * 256
	M = len ( arr [ 0 ] )
	for i in range ( N ) :
		for j in range ( M ) :
			hash [ ord ( arr [ i ] [ j ] ) ] += 1
	for i in range ( 256 ) :
		if ( hash [ i ] % N != 0 ) :
			return False
	return True
arr = [ " fdd " , " fhh " ]
N = len ( arr )
if ( checkEqual ( arr , N ) ) :
	print ( " Yes " )
else :
	print ( " No " )