You are viewing a single comment's thread. Return to all comments →
Code in Go, Please suggest if any optimization can be done.
func matchingStrings(strings []string, queries []string) []int32 { // Write your code here var count int32=0 var stringCount[] int32 for _,query:=range queries{ for _,match:=range strings{ if(query == match){ count = count + 1 } } stringCount = append(stringCount,count) count = 0 }
return stringCount }
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
Code in Go, Please suggest if any optimization can be done.
func matchingStrings(strings []string, queries []string) []int32 { // Write your code here var count int32=0 var stringCount[] int32 for _,query:=range queries{ for _,match:=range strings{ if(query == match){ count = count + 1 } } stringCount = append(stringCount,count) count = 0 }
return stringCount }