go language leetcode-242

main Package 

Import ( 
	"FMT" 
	"the reflect" 
) 

FUNC isAnagram (S String, String T) BOOL { 
	// Map M1 var [String] int 
	// Map M2 var [String] int 
	the stated default // map is nil, to give instantiated by the make 
	M1: = the make (Map [String] int) 
	M2: = the make (Map [String] int) 

	for _, I: Range S = { 
		M1 [String (I)] ++ 
	} 
	for _, J : Range = {T 
		M2 [String (J)] ++ 
	} 
	return reflect.DeepEqual (M1, M2) 
	// Map can not directly use the "==" compares 

} 

FUNC main () { 
	S: = "Hello" 
	T: = "lelho" 
	// isAnagram (S, T) 
	fmt.Println (isAnagram (S, T)) 

}

  

Guess you like

Origin www.cnblogs.com/qstudy/p/11297441.html